Compartir a través de


Assert.AreNotSame Method

Definition

Overloads

AreNotSame(Object, Object, String, Object[])

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

AreNotSame(Object, Object)

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

AreNotSame(Object, Object, String)

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

AreNotSame(Object, Object, String, Object[])

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

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

Parameters

notExpected
Object

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

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 the same as notExpected. The message is shown in test results.

parameters
Object[]

An array of parameters to use when formatting message.

Exceptions

Thrown if notExpected refers to the same object as actual.

Applies to

AreNotSame(Object, Object)

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

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

Parameters

notExpected
Object

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

actual
Object

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

Exceptions

Thrown if notExpected refers to the same object as actual.

Applies to

AreNotSame(Object, Object, String)

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

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

Parameters

notExpected
Object

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

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 the same as notExpected. The message is shown in test results.

Exceptions

Thrown if notExpected refers to the same object as actual.

Applies to