Table of Contents

Method NotEqual

Namespace
Xunit
Assembly
xunit.v3.assert.dll

NotEqual<T>(IEnumerable<T>?, IEnumerable<T>?)

Verifies that two sequences are not equivalent, using a default comparer.

public static void NotEqual<T>(IEnumerable<T>? expected, IEnumerable<T>? actual)

Parameters

expected IEnumerable<T>

The expected object

actual IEnumerable<T>

The actual object

Type Parameters

T

The type of the objects to be compared

Exceptions

Thrown when the objects are equal

NotEqual<T>(IEnumerable<T>?, IEnumerable<T>?, IEqualityComparer<T>)

Verifies that two sequences are not equivalent, using a custom equality comparer.

public static void NotEqual<T>(IEnumerable<T>? expected, IEnumerable<T>? actual, IEqualityComparer<T> comparer)

Parameters

expected IEnumerable<T>

The expected object

actual IEnumerable<T>

The actual object

comparer IEqualityComparer<T>

The comparer used to compare the two objects

Type Parameters

T

The type of the objects to be compared

Exceptions

Thrown when the objects are equal

NotEqual<T>(IEnumerable<T>?, IEnumerable<T>?, Func<T, T, bool>)

Verifies that two collections are not equal, using a comparer function against items in the two collections.

public static void NotEqual<T>(IEnumerable<T>? expected, IEnumerable<T>? actual, Func<T, T, bool> comparer)

Parameters

expected IEnumerable<T>

The expected value

actual IEnumerable<T>

The value to be compared against

comparer Func<T, T, bool>

The function to compare two items for equality

Type Parameters

T

The type of the objects to be compared

NotEqual<T>(T[], T[])

Verifies that two arrays of un-managed type T are not equal, using Span<T>.SequenceEqual.

public static void NotEqual<T>(T[] expected, T[] actual) where T : unmanaged, IEquatable<T>

Parameters

expected T[]

The expected value

actual T[]

The value to be compared against

Type Parameters

T

The type of items whose arrays are to be compared

NotEqual<T>(T, T)

Verifies that two objects are not equal, using a default comparer.

public static void NotEqual<T>(T expected, T actual)

Parameters

expected T

The expected object

actual T

The actual object

Type Parameters

T

The type of the objects to be compared

NotEqual<T>(T, T, Func<T, T, bool>)

Verifies that two objects are not equal, using a custom equality comparer function.

public static void NotEqual<T>(T expected, T actual, Func<T, T, bool> comparer)

Parameters

expected T

The expected object

actual T

The actual object

comparer Func<T, T, bool>

The comparer used to examine the objects

Type Parameters

T

The type of the objects to be compared

NotEqual<T>(T, T, IEqualityComparer<T>)

Verifies that two objects are not equal, using a custom equality comparer.

public static void NotEqual<T>(T expected, T actual, IEqualityComparer<T> comparer)

Parameters

expected T

The expected object

actual T

The actual object

comparer IEqualityComparer<T>

The comparer used to examine the objects

Type Parameters

T

The type of the objects to be compared

NotEqual(double, double, int)

Verifies that two double values are not equal, within the number of decimal places given by precision.

public static void NotEqual(double expected, double actual, int precision)

Parameters

expected double

The expected value

actual double

The value to be compared against

precision int

The number of decimal places (valid values: 0-15)

NotEqual(double, double, int, MidpointRounding)

Verifies that two double values are not equal, within the number of decimal places given by precision. The values are rounded before comparison. The rounding method to use is given by rounding

public static void NotEqual(double expected, double actual, int precision, MidpointRounding rounding)

Parameters

expected double

The expected value

actual double

The value to be compared against

precision int

The number of decimal places (valid values: 0-15)

rounding MidpointRounding

Rounding method to use to process a number that is midway between two numbers

NotEqual(double, double, double)

Verifies that two double values are not equal, within the tolerance given by tolerance (positive or negative).

public static void NotEqual(double expected, double actual, double tolerance)

Parameters

expected double

The expected value

actual double

The value to be compared against

tolerance double

The allowed difference between values

NotEqual(float, float, int)

Verifies that two float values are not equal, within the number of decimal places given by precision.

public static void NotEqual(float expected, float actual, int precision)

Parameters

expected float

The expected value

actual float

The value to be compared against

precision int

The number of decimal places (valid values: 0-15)

NotEqual(float, float, int, MidpointRounding)

Verifies that two float values are not equal, within the number of decimal places given by precision. The values are rounded before comparison. The rounding method to use is given by rounding

public static void NotEqual(float expected, float actual, int precision, MidpointRounding rounding)

Parameters

expected float

The expected value

actual float

The value to be compared against

precision int

The number of decimal places (valid values: 0-15)

rounding MidpointRounding

Rounding method to use to process a number that is midway between two numbers

NotEqual(float, float, float)

Verifies that two float values are not equal, within the tolerance given by tolerance (positive or negative).

public static void NotEqual(float expected, float actual, float tolerance)

Parameters

expected float

The expected value

actual float

The value to be compared against

tolerance float

The allowed difference between values

NotEqual(decimal, decimal, int)

Verifies that two decimal values are not equal, within the number of decimal places given by precision.

public static void NotEqual(decimal expected, decimal actual, int precision)

Parameters

expected decimal

The expected value

actual decimal

The value to be compared against

precision int

The number of decimal places (valid values: 0-28)