Class EqualityAsserts
- Namespace
- Asserts
- Assembly
- xunit.v3.assert.dll
public class EqualityAsserts
- Inheritance
-
EqualityAsserts
- Inherited Members
Methods
Equal(DateTime, DateTime)
Verifies that two DateTime values are equal.
public static void Equal(DateTime expected, DateTime actual)
Parameters
Examples
Add an example for this method ?
Contribution guide.
Equal(DateTime, DateTime, TimeSpan)
Verifies that two DateTime values are equal, within the precision
given by precision.
public static void Equal(DateTime expected, DateTime actual, TimeSpan precision)
Parameters
expectedDateTimeThe expected value
actualDateTimeThe value to be compared against
precisionTimeSpanThe allowed difference in time where the two dates are considered equal
Examples
Add an example for this method ?
Contribution guide.
Equal(DateTimeOffset, DateTimeOffset)
Verifies that two DateTimeOffset values are equal.
public static void Equal(DateTimeOffset expected, DateTimeOffset actual)
Parameters
expectedDateTimeOffsetThe expected value
actualDateTimeOffsetThe value to be compared against
Examples
Add an example for this method ?
Contribution guide.
Equal(DateTimeOffset, DateTimeOffset, TimeSpan)
Verifies that two DateTimeOffset values are equal, within the precision
given by precision.
public static void Equal(DateTimeOffset expected, DateTimeOffset actual, TimeSpan precision)
Parameters
expectedDateTimeOffsetThe expected value
actualDateTimeOffsetThe value to be compared against
precisionTimeSpanThe allowed difference in time where the two dates are considered equal
Examples
Add an example for this method ?
Contribution guide.
Equal(decimal, decimal, int)
Verifies that two decimal values are equal, within the number of decimal
places given by precision. The values are rounded before comparison.
public static void Equal(decimal expected, decimal actual, int precision)
Parameters
expecteddecimalThe expected value
actualdecimalThe value to be compared against
precisionintThe number of decimal places (valid values: 0-28)
Examples
Add an example for this method ?
Contribution guide.
Equal(double, double, double)
Verifies that two double values are equal, within the tolerance given by
tolerance (positive or negative).
public static void Equal(double expected, double actual, double tolerance)
Parameters
expecteddoubleThe expected value
actualdoubleThe value to be compared against
tolerancedoubleThe allowed difference between values
Examples
Add an example for this method ?
Contribution guide.
Equal(double, double, int)
Verifies that two double values are equal, within the number of decimal
places given by precision. The values are rounded before comparison.
public static void Equal(double expected, double actual, int precision)
Parameters
expecteddoubleThe expected value
actualdoubleThe value to be compared against
precisionintThe number of decimal places (valid values: 0-15)
Examples
Add an example for this method ?
Contribution guide.
Equal(double, double, int, MidpointRounding)
Verifies that two double values are 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 Equal(double expected, double actual, int precision, MidpointRounding rounding)
Parameters
expecteddoubleThe expected value
actualdoubleThe value to be compared against
precisionintThe number of decimal places (valid values: 0-15)
roundingMidpointRoundingRounding method to use to process a number that is midway between two numbers
Examples
Add an example for this method ?
Contribution guide.
Equal(float, float, int)
Verifies that two float values are equal, within the number of decimal
places given by precision. The values are rounded before comparison.
public static void Equal(float expected, float actual, int precision)
Parameters
expectedfloatThe expected value
actualfloatThe value to be compared against
precisionintThe number of decimal places (valid values: 0-15)
Examples
Add an example for this method ?
Contribution guide.
Equal(float, float, int, MidpointRounding)
Verifies that two float values are 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 Equal(float expected, float actual, int precision, MidpointRounding rounding)
Parameters
expectedfloatThe expected value
actualfloatThe value to be compared against
precisionintThe number of decimal places (valid values: 0-15)
roundingMidpointRoundingRounding method to use to process a number that is midway between two numbers
Examples
Add an example for this method ?
Contribution guide.
Equal(float, float, float)
Verifies that two float values are equal, within the tolerance given by
tolerance (positive or negative).
public static void Equal(float expected, float actual, float tolerance)
Parameters
expectedfloatThe expected value
actualfloatThe value to be compared against
tolerancefloatThe allowed difference between values
Examples
Add an example for this method ?
Contribution guide.
Equal<T>(T, T)
Verifies that two objects are equal, using a default comparer.
public static void Equal<T>(T expected, T actual)
Parameters
expectedTThe expected value
actualTThe value to be compared against
Type Parameters
TThe type of the objects to be compared
Examples
Add an example for this method ?
Contribution guide.
Equal<T>(T, T, IEqualityComparer<T>)
Verifies that two objects are equal, using a custom equatable comparer.
public static void Equal<T>(T expected, T actual, IEqualityComparer<T> comparer)
Parameters
expectedTThe expected value
actualTThe value to be compared against
comparerIEqualityComparer<T>The comparer used to compare the two objects
Type Parameters
TThe type of the objects to be compared
Examples
Add an example for this method ?
Contribution guide.
Equal<T>(T, T, Func<T, T, bool>)
Verifies that two objects are equal, using a custom comparer function.
public static void Equal<T>(T expected, T actual, Func<T, T, bool> comparer)
Parameters
expectedTThe expected value
actualTThe value to be compared against
comparerFunc<T, T, bool>The comparer used to compare the two objects
Type Parameters
TThe type of the objects to be compared
Examples
Add an example for this method ?
Contribution guide.
Equal<T>(T[], T[])
Verifies that two arrays of un-managed type T are equal, using Span<T>.SequenceEqual. This can be significantly faster than generic enumerables, when the collections are actually equal, because the system can optimize packed-memory comparisons for value type arrays.
public static void Equal<T>(T[] expected, T[] actual) where T : unmanaged, IEquatable<T>
Parameters
expectedT[]The expected value
actualT[]The value to be compared against
Type Parameters
TThe type of items whose arrays are to be compared
Examples
Add an example for this method ?
Contribution guide.
Remarks
If SequenceEqual<T>(Span<T>, ReadOnlySpan<T>) fails, a call to Assert.Equal<T>(T, T) is made, to provide a more meaningful error message.
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
expecteddecimalThe expected value
actualdecimalThe value to be compared against
precisionintThe number of decimal places (valid values: 0-28)
Examples
Add an example for this method ?
Contribution guide.
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
expecteddoubleThe expected value
actualdoubleThe value to be compared against
tolerancedoubleThe allowed difference between values
Examples
Add an example for this method ?
Contribution guide.
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
expecteddoubleThe expected value
actualdoubleThe value to be compared against
precisionintThe number of decimal places (valid values: 0-15)
Examples
Add an example for this method ?
Contribution guide.
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
expecteddoubleThe expected value
actualdoubleThe value to be compared against
precisionintThe number of decimal places (valid values: 0-15)
roundingMidpointRoundingRounding method to use to process a number that is midway between two numbers
Examples
Add an example for this method ?
Contribution guide.
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
expectedfloatThe expected value
actualfloatThe value to be compared against
precisionintThe number of decimal places (valid values: 0-15)
Examples
Add an example for this method ?
Contribution guide.
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
expectedfloatThe expected value
actualfloatThe value to be compared against
precisionintThe number of decimal places (valid values: 0-15)
roundingMidpointRoundingRounding method to use to process a number that is midway between two numbers
Examples
Add an example for this method ?
Contribution guide.
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
expectedfloatThe expected value
actualfloatThe value to be compared against
tolerancefloatThe allowed difference between values
Examples
Add an example for this method ?
Contribution guide.
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
expectedTThe expected object
actualTThe actual object
Type Parameters
TThe type of the objects to be compared
Examples
Add an example for this method ?
Contribution guide.
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
expectedTThe expected object
actualTThe actual object
comparerIEqualityComparer<T>The comparer used to examine the objects
Type Parameters
TThe type of the objects to be compared
Examples
Add an example for this method ?
Contribution guide.
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
expectedTThe expected object
actualTThe actual object
comparerFunc<T, T, bool>The comparer used to examine the objects
Type Parameters
TThe type of the objects to be compared
Examples
Add an example for this method ?
Contribution guide.
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
expectedT[]The expected value
actualT[]The value to be compared against
Type Parameters
TThe type of items whose arrays are to be compared
Examples
Add an example for this method ?
Contribution guide.
NotStrictEqual<T>(T, T)
Verifies that two objects are strictly not equal, using the type's default comparer.
public static void NotStrictEqual<T>(T expected, T actual)
Parameters
expectedTThe expected object
actualTThe actual object
Type Parameters
TThe type of the objects to be compared
Examples
Add an example for this method ?
Contribution guide.
StrictEqual<T>(T, T)
Verifies that two objects are strictly equal, using the type's default comparer.
public static void StrictEqual<T>(T expected, T actual)
Parameters
expectedTThe expected value
actualTThe value to be compared against
Type Parameters
TThe type of the objects to be compared
Examples
Add an example for this method ?
Contribution guide.