Class NotEqualException
Exception thrown when Assert.NotEqual fails.
public class NotEqualException : XunitException, ISerializable, IAssertionException
- Inheritance
-
NotEqualException
- Implements
- Inherited Members
Methods
ForEqualCollections(string, string, string?)
Creates a new instance of NotEqualException to be thrown when two collections are equal.
public static NotEqualException ForEqualCollections(string expected, string actual, string? collectionDisplay = null)
Parameters
expectedstringThe expected collection
actualstringThe actual collection
collectionDisplaystringThe display name for the collection type (defaults to "Collections")
Returns
ForEqualCollectionsWithError(int?, string, int?, string, int?, Exception?, string?)
Creates a new instance of NotEqualException to be thrown when two collections are equal, and an error has occurred during comparison.
public static NotEqualException ForEqualCollectionsWithError(int? mismatchedIndex, string expected, int? expectedPointer, string actual, int? actualPointer, Exception? error = null, string? collectionDisplay = null)
Parameters
mismatchedIndexint?The index at which the collections error occurred (should be
nullwhenerrorisnull)expectedstringThe expected collection
expectedPointerint?The spacing into the expected collection where the difference occurs (should be
nullwhenerroris null)actualstringThe actual collection
actualPointerint?The spacing into the actual collection where the difference occurs (should be
nullwhenerroris null)errorExceptionThe optional exception that was thrown during comparison
collectionDisplaystringThe display name for the collection type (defaults to "Collections")
Returns
ForEqualValues(string, string, string?)
Creates a new instance of NotEqualException to be thrown when two values are equal. This may be simple values (like intrinsics) or complex values (like classes or structs).
public static NotEqualException ForEqualValues(string expected, string actual, string? banner = null)
Parameters
expectedstringThe expected value
actualstringThe actual value
bannerstringThe banner to show; if
null, then the standard banner of "Values are equal" will be used
Returns
ForEqualValuesWithError(string, string, Exception?, string?)
Creates a new instance of NotEqualException to be thrown when two values are equal. This may be simple values (like intrinsics) or complex values (like classes or structs). Used when an error has occurred during comparison.
public static NotEqualException ForEqualValuesWithError(string expected, string actual, Exception? error = null, string? banner = null)
Parameters
expectedstringThe expected value
actualstringThe actual value
errorExceptionThe optional exception that was thrown during comparison
bannerstringThe banner to show; if
null, then the standard banner of "Values are equal" will be used. Iferroris notnull, then the banner used will always be "Exception thrown during comparison", regardless of the value passed here.