Language

Assert.AreNotEquivalent Method

Definition

Overloads

Name Description
AreNotEquivalent<T>(T, T, Boolean, String, String, String)

Tests whether two object graphs are NOT structurally equivalent and throws an exception if they are.

AreNotEquivalent<T>(Span<T>, Span<T>, Boolean, String, String, String)

Tests whether two spans are NOT structurally equivalent.

AreNotEquivalent<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, Boolean, String, String, String)

Tests whether two spans are NOT structurally equivalent.

AreNotEquivalent<T>(ReadOnlyMemory<T>, ReadOnlyMemory<T>, Boolean, String, String, String)

Tests whether two memory regions are NOT structurally equivalent.

AreNotEquivalent<T>(Memory<T>, Memory<T>, Boolean, String, String, String)

Tests whether two memory regions are NOT structurally equivalent.

AreNotEquivalent<T>(T, T, String, String, String)

Tests whether two object graphs are NOT structurally equivalent and throws an exception if they are.

AreNotEquivalent<T>(Span<T>, Span<T>, String, String, String)

Tests whether two spans are NOT structurally equivalent.

AreNotEquivalent<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, String, String, String)

Tests whether two spans are NOT structurally equivalent.

AreNotEquivalent<T>(ReadOnlyMemory<T>, ReadOnlyMemory<T>, String, String, String)

Tests whether two memory regions are NOT structurally equivalent.

AreNotEquivalent<T>(Memory<T>, Memory<T>, String, String, String)

Tests whether two memory regions are NOT structurally equivalent.

AreNotEquivalent<T>(T, T, Boolean, String, String, String)

Source:
Assert.AreEquivalent.cs

Tests whether two object graphs are NOT structurally equivalent and throws an exception if they are.

public static void AreNotEquivalent<T>(T? notExpected, T? actual, bool strict, string? message = "", string notExpectedExpression = "", string actualExpression = "");
static member AreNotEquivalent : 'T * 'T * bool * string * string * string -> unit
Public Shared Sub AreNotEquivalent(Of T) (notExpected As T, actual As T, strict As Boolean, Optional message As String = "", Optional notExpectedExpression As String = "", Optional actualExpression As String = "")

Type Parameters

T

The type of values to compare.

Parameters

notExpected
T

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

actual
T

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

strict
Boolean

When true, the equivalence check used to decide whether the assertion fails is performed in strict mode (extra members or dictionary keys on actual are considered a difference, so the assertion succeeds in their presence).

message
String

The message to include in the exception when actual is equivalent to notExpected. The message is shown in test results.

notExpectedExpression
String

The syntactic expression of notExpected as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

actualExpression
String

The syntactic expression of actual as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

Exceptions

Thrown if notExpected and actual are structurally equivalent, or if the structural comparison cannot be completed.

Applies to

AreNotEquivalent<T>(Span<T>, Span<T>, Boolean, String, String, String)

Tests whether two spans are NOT structurally equivalent.

public static void AreNotEquivalent<T>(Span<T> notExpected, Span<T> actual, bool strict, string? message = "", string notExpectedExpression = "", string actualExpression = "");
static member AreNotEquivalent : Span<'T> * Span<'T> * bool * string * string * string -> unit
Public Shared Sub AreNotEquivalent(Of T) (notExpected As Span(Of T), actual As Span(Of T), strict As Boolean, Optional message As String = "", Optional notExpectedExpression As String = "", Optional actualExpression As String = "")

Type Parameters

T

The element type of the spans.

Parameters

notExpected
Span<T>

The span the test expects not to match actual.

actual
Span<T>

The span produced by the code under test.

strict
Boolean

When true, the comparison is performed in strict mode.

message
String

The message to include in the exception when the assertion fails.

notExpectedExpression
String

The syntactic expression of notExpected as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

actualExpression
String

The syntactic expression of actual as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

Applies to

AreNotEquivalent<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, Boolean, String, String, String)

Tests whether two spans are NOT structurally equivalent.

public static void AreNotEquivalent<T>(ReadOnlySpan<T> notExpected, ReadOnlySpan<T> actual, bool strict, string? message = "", string notExpectedExpression = "", string actualExpression = "");
static member AreNotEquivalent : ReadOnlySpan<'T> * ReadOnlySpan<'T> * bool * string * string * string -> unit
Public Shared Sub AreNotEquivalent(Of T) (notExpected As ReadOnlySpan(Of T), actual As ReadOnlySpan(Of T), strict As Boolean, Optional message As String = "", Optional notExpectedExpression As String = "", Optional actualExpression As String = "")

Type Parameters

T

The element type of the spans.

Parameters

notExpected
ReadOnlySpan<T>

The span the test expects not to match actual.

actual
ReadOnlySpan<T>

The span produced by the code under test.

strict
Boolean

When true, the comparison is performed in strict mode.

message
String

The message to include in the exception when the assertion fails.

notExpectedExpression
String

The syntactic expression of notExpected as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

actualExpression
String

The syntactic expression of actual as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

Applies to

AreNotEquivalent<T>(ReadOnlyMemory<T>, ReadOnlyMemory<T>, Boolean, String, String, String)

Tests whether two memory regions are NOT structurally equivalent.

public static void AreNotEquivalent<T>(ReadOnlyMemory<T> notExpected, ReadOnlyMemory<T> actual, bool strict, string? message = "", string notExpectedExpression = "", string actualExpression = "");
static member AreNotEquivalent : ReadOnlyMemory<'T> * ReadOnlyMemory<'T> * bool * string * string * string -> unit
Public Shared Sub AreNotEquivalent(Of T) (notExpected As ReadOnlyMemory(Of T), actual As ReadOnlyMemory(Of T), strict As Boolean, Optional message As String = "", Optional notExpectedExpression As String = "", Optional actualExpression As String = "")

Type Parameters

T

The element type of the memory regions.

Parameters

notExpected
ReadOnlyMemory<T>

The memory the test expects not to match actual.

actual
ReadOnlyMemory<T>

The memory produced by the code under test.

strict
Boolean

When true, the comparison is performed in strict mode.

message
String

The message to include in the exception when the assertion fails.

notExpectedExpression
String

The syntactic expression of notExpected as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

actualExpression
String

The syntactic expression of actual as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

Applies to

AreNotEquivalent<T>(Memory<T>, Memory<T>, Boolean, String, String, String)

Tests whether two memory regions are NOT structurally equivalent.

public static void AreNotEquivalent<T>(Memory<T> notExpected, Memory<T> actual, bool strict, string? message = "", string notExpectedExpression = "", string actualExpression = "");
static member AreNotEquivalent : Memory<'T> * Memory<'T> * bool * string * string * string -> unit
Public Shared Sub AreNotEquivalent(Of T) (notExpected As Memory(Of T), actual As Memory(Of T), strict As Boolean, Optional message As String = "", Optional notExpectedExpression As String = "", Optional actualExpression As String = "")

Type Parameters

T

The element type of the memory regions.

Parameters

notExpected
Memory<T>

The memory the test expects not to match actual.

actual
Memory<T>

The memory produced by the code under test.

strict
Boolean

When true, the comparison is performed in strict mode.

message
String

The message to include in the exception when the assertion fails.

notExpectedExpression
String

The syntactic expression of notExpected as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

actualExpression
String

The syntactic expression of actual as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

Applies to

AreNotEquivalent<T>(T, T, String, String, String)

Source:
Assert.AreEquivalent.cs

Tests whether two object graphs are NOT structurally equivalent and throws an exception if they are.

public static void AreNotEquivalent<T>(T? notExpected, T? actual, string? message = "", string notExpectedExpression = "", string actualExpression = "");
static member AreNotEquivalent : 'T * 'T * string * string * string -> unit
Public Shared Sub AreNotEquivalent(Of T) (notExpected As T, actual As T, Optional message As String = "", Optional notExpectedExpression As String = "", Optional actualExpression As String = "")

Type Parameters

T

The type of values to compare.

Parameters

notExpected
T

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

actual
T

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

message
String

The message to include in the exception when actual is equivalent to notExpected. The message is shown in test results.

notExpectedExpression
String

The syntactic expression of notExpected as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

actualExpression
String

The syntactic expression of actual as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

Exceptions

Thrown if notExpected and actual are structurally equivalent, or if the structural comparison cannot be completed.

Remarks

See AreEquivalent<T>(T, T, String, String, String) and AreEquivalent<T>(T, T, Boolean, String, String, String) for the full set of comparison rules.

Applies to

AreNotEquivalent<T>(Span<T>, Span<T>, String, String, String)

Tests whether two spans are NOT structurally equivalent.

public static void AreNotEquivalent<T>(Span<T> notExpected, Span<T> actual, string? message = "", string notExpectedExpression = "", string actualExpression = "");
static member AreNotEquivalent : Span<'T> * Span<'T> * string * string * string -> unit
Public Shared Sub AreNotEquivalent(Of T) (notExpected As Span(Of T), actual As Span(Of T), Optional message As String = "", Optional notExpectedExpression As String = "", Optional actualExpression As String = "")

Type Parameters

T

The element type of the spans.

Parameters

notExpected
Span<T>

The span the test expects not to match actual.

actual
Span<T>

The span produced by the code under test.

message
String

The message to include in the exception when the assertion fails.

notExpectedExpression
String

The syntactic expression of notExpected as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

actualExpression
String

The syntactic expression of actual as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

Applies to

AreNotEquivalent<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, String, String, String)

Tests whether two spans are NOT structurally equivalent.

public static void AreNotEquivalent<T>(ReadOnlySpan<T> notExpected, ReadOnlySpan<T> actual, string? message = "", string notExpectedExpression = "", string actualExpression = "");
static member AreNotEquivalent : ReadOnlySpan<'T> * ReadOnlySpan<'T> * string * string * string -> unit
Public Shared Sub AreNotEquivalent(Of T) (notExpected As ReadOnlySpan(Of T), actual As ReadOnlySpan(Of T), Optional message As String = "", Optional notExpectedExpression As String = "", Optional actualExpression As String = "")

Type Parameters

T

The element type of the spans.

Parameters

notExpected
ReadOnlySpan<T>

The span the test expects not to match actual.

actual
ReadOnlySpan<T>

The span produced by the code under test.

message
String

The message to include in the exception when the assertion fails.

notExpectedExpression
String

The syntactic expression of notExpected as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

actualExpression
String

The syntactic expression of actual as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

Applies to

AreNotEquivalent<T>(ReadOnlyMemory<T>, ReadOnlyMemory<T>, String, String, String)

Tests whether two memory regions are NOT structurally equivalent.

public static void AreNotEquivalent<T>(ReadOnlyMemory<T> notExpected, ReadOnlyMemory<T> actual, string? message = "", string notExpectedExpression = "", string actualExpression = "");
static member AreNotEquivalent : ReadOnlyMemory<'T> * ReadOnlyMemory<'T> * string * string * string -> unit
Public Shared Sub AreNotEquivalent(Of T) (notExpected As ReadOnlyMemory(Of T), actual As ReadOnlyMemory(Of T), Optional message As String = "", Optional notExpectedExpression As String = "", Optional actualExpression As String = "")

Type Parameters

T

The element type of the memory regions.

Parameters

notExpected
ReadOnlyMemory<T>

The memory the test expects not to match actual.

actual
ReadOnlyMemory<T>

The memory produced by the code under test.

message
String

The message to include in the exception when the assertion fails.

notExpectedExpression
String

The syntactic expression of notExpected as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

actualExpression
String

The syntactic expression of actual as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

Applies to

AreNotEquivalent<T>(Memory<T>, Memory<T>, String, String, String)

Tests whether two memory regions are NOT structurally equivalent.

public static void AreNotEquivalent<T>(Memory<T> notExpected, Memory<T> actual, string? message = "", string notExpectedExpression = "", string actualExpression = "");
static member AreNotEquivalent : Memory<'T> * Memory<'T> * string * string * string -> unit
Public Shared Sub AreNotEquivalent(Of T) (notExpected As Memory(Of T), actual As Memory(Of T), Optional message As String = "", Optional notExpectedExpression As String = "", Optional actualExpression As String = "")

Type Parameters

T

The element type of the memory regions.

Parameters

notExpected
Memory<T>

The memory the test expects not to match actual.

actual
Memory<T>

The memory produced by the code under test.

message
String

The message to include in the exception when the assertion fails.

notExpectedExpression
String

The syntactic expression of notExpected as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

actualExpression
String

The syntactic expression of actual as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

Applies to