Delen via


Assert.AreSame Method

Definition

Overloads

AreSame(Object, Object, String)

Tests whether the specified objects both refer to the same object and throws an exception if the two inputs do not refer to the same object.

AreSame(Object, Object, String, Object[])

Tests whether the specified objects both refer to the same object and throws an exception if the two inputs do not refer to the same object.

AreSame(Object, Object)

Tests whether the specified objects both refer to the same object and throws an exception if the two inputs do not refer to the same object.

AreSame(Object, Object, String)

Tests whether the specified objects both refer to the same object and throws an exception if the two inputs do not refer to the same object.

public:
 static void AreSame(System::Object ^ expected, System::Object ^ actual, System::String ^ message);
public static void AreSame (object expected, object actual, string message);
static member AreSame : obj * obj * string -> unit
Public Shared Sub AreSame (expected As Object, actual As Object, message As String)

Parameters

expected
Object

The first object to compare. This is the value the test expects.

actual
Object

The second object to compare. This is the value produced by the code under test.

message
String

The message to include in the exception when actual is not the same as expected. The message is shown in test results.

Exceptions

Thrown if expected does not refer to the same object as actual.

Applies to

AreSame(Object, Object, String, Object[])

Tests whether the specified objects both refer to the same object and throws an exception if the two inputs do not refer to the same object.

public:
 static void AreSame(System::Object ^ expected, System::Object ^ actual, System::String ^ message, ... cli::array <System::Object ^> ^ parameters);
public static void AreSame (object expected, object actual, string message, params object[] parameters);
static member AreSame : obj * obj * string * obj[] -> unit
Public Shared Sub AreSame (expected As Object, actual As Object, message As String, ParamArray parameters As Object())

Parameters

expected
Object

The first object to compare. This is the value the test expects.

actual
Object

The second object to compare. This is the value produced by the code under test.

message
String

The message to include in the exception when actual is not the same as expected. The message is shown in test results.

parameters
Object[]

An array of parameters to use when formatting message.

Exceptions

Thrown if expected does not refer to the same object as actual.

Applies to

AreSame(Object, Object)

Tests whether the specified objects both refer to the same object and throws an exception if the two inputs do not refer to the same object.

public:
 static void AreSame(System::Object ^ expected, System::Object ^ actual);
public static void AreSame (object expected, object actual);
static member AreSame : obj * obj -> unit
Public Shared Sub AreSame (expected As Object, actual As Object)

Parameters

expected
Object

The first object to compare. This is the value the test expects.

actual
Object

The second object to compare. This is the value produced by the code under test.

Exceptions

Thrown if expected does not refer to the same object as actual.

Applies to