Table of Contents

Class Assert

Namespace
Xunit
Assembly
xunit.v3.assert.dll

Contains various static methods that are used to verify that conditions are met during the process of running tests.

public class Assert
Inheritance
Assert
Inherited Members

Constructors

Assert()

Initializes a new instance of the Assert class.

Methods

AllAsync<T>(IEnumerable<T>, Func<T, int, Task>)

Verifies that all items in the collection pass when executed against action. The item index is provided to the action, in addition to the item.

AllAsync<T>(IEnumerable<T>, Func<T, Task>)

Verifies that all items in the collection pass when executed against action.

All<T>(IEnumerable<T>, Action<T, int>)

Verifies that all items in the collection pass when executed against action. The item index is provided to the action, in addition to the item.

All<T>(IEnumerable<T>, Action<T>)

Verifies that all items in the collection pass when executed against action.

CollectionAsync<T>(IEnumerable<T>, params Func<T, Task>[])

Verifies that a collection contains exactly a given number of elements, which meet the criteria provided by the element inspectors.

Collection<T>(IEnumerable<T>, params Action<T>[])

Verifies that a collection contains exactly a given number of elements, which meet the criteria provided by the element inspectors.

Contains(Memory<char>, Memory<char>)

Verifies that a string contains a given sub-string, using the current culture.

Contains(Memory<char>, Memory<char>, StringComparison)

Verifies that a string contains a given sub-string, using the given comparison type.

Contains(Memory<char>, ReadOnlyMemory<char>)

Verifies that a string contains a given sub-string, using the current culture.

Contains(Memory<char>, ReadOnlyMemory<char>, StringComparison)

Verifies that a string contains a given sub-string, using the given comparison type.

Contains(ReadOnlyMemory<char>, Memory<char>)

Verifies that a string contains a given sub-string, using the current culture.

Contains(ReadOnlyMemory<char>, Memory<char>, StringComparison)

Verifies that a string contains a given sub-string, using the given comparison type.

Contains(ReadOnlyMemory<char>, ReadOnlyMemory<char>)

Verifies that a string contains a given sub-string, using the current culture.

Contains(ReadOnlyMemory<char>, ReadOnlyMemory<char>, StringComparison)

Verifies that a string contains a given sub-string, using the given comparison type.

Contains(ReadOnlySpan<char>, ReadOnlySpan<char>)

Verifies that a string contains a given string, using the current culture.

Contains(ReadOnlySpan<char>, ReadOnlySpan<char>, StringComparison)

Verifies that a string contains a given string, using the given comparison type.

Contains(ReadOnlySpan<char>, Span<char>)

Verifies that a string contains a given string, using the current culture.

Contains(ReadOnlySpan<char>, Span<char>, StringComparison)

Verifies that a string contains a given string, using the given comparison type.

Contains(Span<char>, ReadOnlySpan<char>)

Verifies that a string contains a given string, using the current culture.

Contains(Span<char>, ReadOnlySpan<char>, StringComparison)

Verifies that a string contains a given string, using the given comparison type.

Contains(Span<char>, Span<char>)

Verifies that a string contains a given string, using the current culture.

Contains(Span<char>, Span<char>, StringComparison)

Verifies that a string contains a given string, using the given comparison type.

Contains(string, string?)

Verifies that a string contains a given sub-string, using the current culture.

Contains(string, string?, StringComparison)

Verifies that a string contains a given sub-string, using the given comparison type.

Contains<T>(IEnumerable<T>, Predicate<T>)

Verifies that a collection contains a given object.

Contains<T>(Memory<T>, Memory<T>)

Verifies that a Memory contains a given sub-Memory

Contains<T>(Memory<T>, ReadOnlyMemory<T>)

Verifies that a Memory contains a given sub-Memory

Contains<T>(ReadOnlyMemory<T>, Memory<T>)

Verifies that a Memory contains a given sub-Memory

Contains<T>(ReadOnlyMemory<T>, ReadOnlyMemory<T>)

Verifies that a Memory contains a given sub-Memory

Contains<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)

Verifies that a span contains a given sub-span

Contains<T>(ReadOnlySpan<T>, Span<T>)

Verifies that a span contains a given sub-span

Contains<T>(Span<T>, ReadOnlySpan<T>)

Verifies that a span contains a given sub-span

Contains<T>(Span<T>, Span<T>)

Verifies that a span contains a given sub-span

Contains<T>(T, HashSet<T>)

Verifies that the hashset contains the given object.

Contains<T>(T, IEnumerable<T>)

Verifies that a collection contains a given object.

Contains<T>(T, IEnumerable<T>, IEqualityComparer<T>)

Verifies that a collection contains a given object, using an equality comparer.

Contains<T>(T, ISet<T>)

Verifies that the set contains the given object.

Contains<T>(T, SortedSet<T>)

Verifies that the sorted hashset contains the given object.

Contains<T>(T, ImmutableHashSet<T>)

Verifies that the immutable hashset contains the given object.

Contains<T>(T, ImmutableSortedSet<T>)

Verifies that the immutable sorted hashset contains the given object.

Contains<TKey, TValue>(TKey, ConcurrentDictionary<TKey, TValue>)

Verifies that a dictionary contains a given key.

Contains<TKey, TValue>(TKey, Dictionary<TKey, TValue>)

Verifies that a dictionary contains a given key.

Contains<TKey, TValue>(TKey, IDictionary<TKey, TValue>)

Verifies that a dictionary contains a given key.

Contains<TKey, TValue>(TKey, IReadOnlyDictionary<TKey, TValue>)

Verifies that a read-only dictionary contains a given key.

Contains<TKey, TValue>(TKey, ImmutableDictionary<TKey, TValue>)

Verifies that a dictionary contains a given key.

Contains<TKey, TValue>(TKey, ReadOnlyDictionary<TKey, TValue>)

Verifies that a dictionary contains a given key.

Distinct<T>(IEnumerable<T>)

Verifies that a collection contains each object only once.

Distinct<T>(IEnumerable<T>, IEqualityComparer<T>)

Verifies that a collection contains each object only once.

DoesNotContain(Memory<char>, Memory<char>)

Verifies that a string does not contain a given sub-string, using the current culture.

DoesNotContain(Memory<char>, Memory<char>, StringComparison)

Verifies that a string does not contain a given sub-string, using the given comparison type.

DoesNotContain(Memory<char>, ReadOnlyMemory<char>)

Verifies that a string does not contain a given sub-string, using the current culture.

DoesNotContain(Memory<char>, ReadOnlyMemory<char>, StringComparison)

Verifies that a string does not contain a given sub-string, using the given comparison type.

DoesNotContain(ReadOnlyMemory<char>, Memory<char>)

Verifies that a string does not contain a given sub-string, using the current culture.

DoesNotContain(ReadOnlyMemory<char>, Memory<char>, StringComparison)

Verifies that a string does not contain a given sub-string, using the given comparison type.

DoesNotContain(ReadOnlyMemory<char>, ReadOnlyMemory<char>)

Verifies that a string does not contain a given sub-string, using the current culture.

DoesNotContain(ReadOnlyMemory<char>, ReadOnlyMemory<char>, StringComparison)

Verifies that a string does not contain a given sub-string, using the given comparison type.

DoesNotContain(ReadOnlySpan<char>, ReadOnlySpan<char>)

Verifies that a string does not contain a given sub-string, using the current culture.

DoesNotContain(ReadOnlySpan<char>, ReadOnlySpan<char>, StringComparison)

Verifies that a string does not contain a given sub-string, using the given comparison type.

DoesNotContain(ReadOnlySpan<char>, Span<char>)

Verifies that a string does not contain a given sub-string, using the current culture.

DoesNotContain(ReadOnlySpan<char>, Span<char>, StringComparison)

Verifies that a string does not contain a given sub-string, using the given comparison type.

DoesNotContain(Span<char>, ReadOnlySpan<char>)

Verifies that a string does not contain a given sub-string, using the current culture.

DoesNotContain(Span<char>, ReadOnlySpan<char>, StringComparison)

Verifies that a string does not contain a given sub-string, using the given comparison type.

DoesNotContain(Span<char>, Span<char>)

Verifies that a string does not contain a given sub-string, using the current culture.

DoesNotContain(Span<char>, Span<char>, StringComparison)

Verifies that a string does not contain a given sub-string, using the given comparison type.

DoesNotContain(string, string?)

Verifies that a string does not contain a given sub-string, using the current culture.

DoesNotContain(string, string?, StringComparison)

Verifies that a string does not contain a given sub-string, using the current culture.

DoesNotContain<T>(IEnumerable<T>, Predicate<T>)

Verifies that a collection does not contain a given object.

DoesNotContain<T>(Memory<T>, Memory<T>)

Verifies that a Memory does not contain a given sub-Memory

DoesNotContain<T>(Memory<T>, ReadOnlyMemory<T>)

Verifies that a Memory does not contain a given sub-Memory

DoesNotContain<T>(ReadOnlyMemory<T>, Memory<T>)

Verifies that a Memory does not contain a given sub-Memory

DoesNotContain<T>(ReadOnlyMemory<T>, ReadOnlyMemory<T>)

Verifies that a Memory does not contain a given sub-Memory

DoesNotContain<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)

Verifies that a span does not contain a given sub-span

DoesNotContain<T>(ReadOnlySpan<T>, Span<T>)

Verifies that a span does not contain a given sub-span

DoesNotContain<T>(Span<T>, ReadOnlySpan<T>)

Verifies that a span does not contain a given sub-span

DoesNotContain<T>(Span<T>, Span<T>)

Verifies that a span does not contain a given sub-span

DoesNotContain<T>(T, HashSet<T>)

Verifies that the hashset does not contain the given item.

DoesNotContain<T>(T, IEnumerable<T>)

Verifies that a collection does not contain a given object.

DoesNotContain<T>(T, IEnumerable<T>, IEqualityComparer<T>)

Verifies that a collection does not contain a given object, using an equality comparer.

DoesNotContain<T>(T, ISet<T>)

Verifies that the set does not contain the given item.

DoesNotContain<T>(T, SortedSet<T>)

Verifies that the sorted hashset does not contain the given item.

DoesNotContain<T>(T, ImmutableHashSet<T>)

Verifies that the immutable hashset does not contain the given item.

DoesNotContain<T>(T, ImmutableSortedSet<T>)

Verifies that the immutable sorted hashset does not contain the given item.

DoesNotContain<TKey, TValue>(TKey, ConcurrentDictionary<TKey, TValue>)

Verifies that a dictionary does not contain a given key.

DoesNotContain<TKey, TValue>(TKey, Dictionary<TKey, TValue>)

Verifies that a dictionary does not contain a given key.

DoesNotContain<TKey, TValue>(TKey, IDictionary<TKey, TValue>)

Verifies that a dictionary does not contain a given key.

DoesNotContain<TKey, TValue>(TKey, IReadOnlyDictionary<TKey, TValue>)

Verifies that a dictionary does not contain a given key.

DoesNotContain<TKey, TValue>(TKey, ImmutableDictionary<TKey, TValue>)

Verifies that a dictionary does not contain a given key.

DoesNotContain<TKey, TValue>(TKey, ReadOnlyDictionary<TKey, TValue>)

Verifies that a dictionary does not contain a given key.

DoesNotMatch(string, string?)

Verifies that a string does not match a regular expression.

DoesNotMatch(Regex, string?)

Verifies that a string does not match a regular expression.

Empty(IEnumerable)

Verifies that a collection is empty.

Empty(string)

Verifies that a string is empty.

EndsWith(Memory<char>, Memory<char>)

Verifies that a string ends with a given sub-string, using the current culture.

EndsWith(Memory<char>, Memory<char>, StringComparison)

Verifies that a string ends with a given sub-string, using the given comparison type.

EndsWith(Memory<char>, ReadOnlyMemory<char>)

Verifies that a string ends with a given sub-string, using the current culture.

EndsWith(Memory<char>, ReadOnlyMemory<char>, StringComparison)

Verifies that a string ends with a given sub-string, using the given comparison type.

EndsWith(ReadOnlyMemory<char>, Memory<char>)

Verifies that a string ends with a given sub-string, using the current culture.

EndsWith(ReadOnlyMemory<char>, Memory<char>, StringComparison)

Verifies that a string ends with a given sub-string, using the given comparison type.

EndsWith(ReadOnlyMemory<char>, ReadOnlyMemory<char>)

Verifies that a string ends with a given sub-string, using the current culture.

EndsWith(ReadOnlyMemory<char>, ReadOnlyMemory<char>, StringComparison)

Verifies that a string ends with a given sub-string, using the given comparison type.

EndsWith(ReadOnlySpan<char>, ReadOnlySpan<char>)

Verifies that a string ends with a given sub-string, using the current culture.

EndsWith(ReadOnlySpan<char>, ReadOnlySpan<char>, StringComparison)

Verifies that a string ends with a given sub-string, using the given comparison type.

EndsWith(ReadOnlySpan<char>, Span<char>)

Verifies that a string ends with a given sub-string, using the current culture.

EndsWith(ReadOnlySpan<char>, Span<char>, StringComparison)

Verifies that a string ends with a given sub-string, using the given comparison type.

EndsWith(Span<char>, ReadOnlySpan<char>)

Verifies that a string ends with a given sub-string, using the current culture.

EndsWith(Span<char>, ReadOnlySpan<char>, StringComparison)

Verifies that a string ends with a given sub-string, using the given comparison type.

EndsWith(Span<char>, Span<char>)

Verifies that a string ends with a given sub-string, using the current culture.

EndsWith(Span<char>, Span<char>, StringComparison)

Verifies that a string ends with a given sub-string, using the given comparison type.

EndsWith(string?, string?)

Verifies that a string ends with a given sub-string, using the current culture.

EndsWith(string?, string?, StringComparison)

Verifies that a string ends with a given sub-string, using the given comparison type.

Equal(DateTime, DateTime)

Verifies that two DateTime values are equal.

Equal(DateTime, DateTime, TimeSpan)

Verifies that two DateTime values are equal, within the precision given by precision.

Equal(DateTimeOffset, DateTimeOffset)

Verifies that two DateTimeOffset values are equal.

Equal(DateTimeOffset, DateTimeOffset, TimeSpan)

Verifies that two DateTimeOffset values are equal, within the precision given by precision.

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.

Equal(double, double, double)

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

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.

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

Equal(Memory<char>, Memory<char>)

Verifies that two strings are equivalent.

Equal(Memory<char>, Memory<char>, bool, bool, bool, bool)

Verifies that two strings are equivalent.

Equal(Memory<char>, ReadOnlyMemory<char>)

Verifies that two strings are equivalent.

Equal(Memory<char>, ReadOnlyMemory<char>, bool, bool, bool, bool)

Verifies that two strings are equivalent.

Equal(ReadOnlyMemory<char>, Memory<char>)

Verifies that two strings are equivalent.

Equal(ReadOnlyMemory<char>, Memory<char>, bool, bool, bool, bool)

Verifies that two strings are equivalent.

Equal(ReadOnlyMemory<char>, ReadOnlyMemory<char>)

Verifies that two strings are equivalent.

Equal(ReadOnlyMemory<char>, ReadOnlyMemory<char>, bool, bool, bool, bool)

Verifies that two strings are equivalent.

Equal(ReadOnlySpan<char>, ReadOnlySpan<char>)

Verifies that two strings are equivalent.

Equal(ReadOnlySpan<char>, ReadOnlySpan<char>, bool, bool, bool, bool)

Verifies that two strings are equivalent.

Equal(ReadOnlySpan<char>, Span<char>)

Verifies that two strings are equivalent.

Equal(ReadOnlySpan<char>, Span<char>, bool, bool, bool, bool)

Verifies that two strings are equivalent.

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.

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

Equal(float, float, float)

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

Equal(Span<char>, ReadOnlySpan<char>)

Verifies that two strings are equivalent.

Equal(Span<char>, ReadOnlySpan<char>, bool, bool, bool, bool)

Verifies that two strings are equivalent.

Equal(Span<char>, Span<char>)

Verifies that two strings are equivalent.

Equal(Span<char>, Span<char>, bool, bool, bool, bool)

Verifies that two strings are equivalent.

Equal(string?, string?)

Verifies that two strings are equivalent.

Equal(string?, string?, bool, bool, bool, bool)

Verifies that two strings are equivalent.

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

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

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

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

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

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

Equal<T>(Memory<T>, Memory<T>)

Verifies that two Memory values are equivalent.

Equal<T>(Memory<T>, ReadOnlyMemory<T>)

Verifies that two Memory values are equivalent.

Equal<T>(ReadOnlyMemory<T>, Memory<T>)

Verifies that two Memory values are equivalent.

Equal<T>(ReadOnlyMemory<T>, ReadOnlyMemory<T>)

Verifies that two Memory values are equivalent.

Equal<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)

Verifies that two spans contain the same values in the same order.

Equal<T>(ReadOnlySpan<T>, Span<T>)

Verifies that two spans contain the same values in the same order.

Equal<T>(ReadOnlySpan<T>, T[])

Verifies that a span and an array contain the same values in the same order.

Equal<T>(Span<T>, ReadOnlySpan<T>)

Verifies that two spans contain the same values in the same order.

Equal<T>(Span<T>, Span<T>)

Verifies that two spans contain the same values in the same order.

Equal<T>(T, T)

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

Equal<T>(T, T, IEqualityComparer<T>)

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

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

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

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.

Equivalent(object?, object?, bool)

Verifies that two objects are equivalent, using a default comparer. This comparison is done without regard to type, and only inspects public property and field values for individual equality. Deep equivalence tests (meaning, property or fields which are themselves complex types) are supported.

EquivalentWithExclusions(object?, object?, bool, params string[])

Verifies that two objects are equivalent, using a default comparer. This comparison is done without regard to type, and only inspects public property and field values for individual equality. Deep equivalence tests (meaning, property or fields which are themselves complex types) are supported. Members can be excluded from the comparison by passing them as expressions via exclusionExpressions (using "Member.SubMember.SubSubMember" form).

EquivalentWithExclusions(object?, object?, params string[])

Verifies that two objects are equivalent, using a default comparer. This comparison is done without regard to type, and only inspects public property and field values for individual equality. Deep equivalence tests (meaning, property or fields which are themselves complex types) are supported. Members can be excluded from the comparison by passing them as expressions via exclusionExpressions (using "Member.SubMember.SubSubMember" form).

EquivalentWithExclusions<T>(object?, T, bool, params Expression<Func<T, object?>>[])

Verifies that two objects are equivalent, using a default comparer. This comparison is done without regard to type, and only inspects public property and field values for individual equality. Deep equivalence tests (meaning, property or fields which are themselves complex types) are supported. Members can be excluded from the comparison by passing them as expressions via exclusionExpressions (using lambda expressions).

EquivalentWithExclusions<T>(object?, T, params Expression<Func<T, object?>>[])

Verifies that two objects are equivalent, using a default comparer. This comparison is done without regard to type, and only inspects public property and field values for individual equality. Deep equivalence tests (meaning, property or fields which are themselves complex types) are supported. Members can be excluded from the comparison by passing them as expressions via exclusionExpressions (using lambda expressions).

Fail(string?)

Indicates that the test should immediately fail.

False(bool)

Verifies that the condition is false.

False(bool, string?)

Verifies that the condition is false.

False(bool?)

Verifies that the condition is false.

False(bool?, string?)

Verifies that the condition is false.

InRange<T>(T, T, T)

Verifies that a value is within a given range.

InRange<T>(T, T, T, IComparer<T>)

Verifies that a value is within a given range, using a comparer.

IsAssignableFrom(Type, object?)

Verifies that an object is of the given type or a derived type.

IsAssignableFrom<T>(object?)

Verifies that an object is of the given type or a derived type.

IsNotAssignableFrom(Type, object?)

Verifies that an object is not of the given type or a derived type.

IsNotAssignableFrom<T>(object?)

Verifies that an object is not of the given type or a derived type.

IsNotType(Type, object?)

Verifies that an object is not exactly the given type.

IsNotType(Type, object?, bool)

Verifies that an object is not of the given type.

IsNotType<T>(object?)

Verifies that an object is not exactly the given type.

IsNotType<T>(object?, bool)

Verifies that an object is not of the given type.

IsType(Type, object?)

Verifies that an object is exactly the given type (and not a derived type).

IsType(Type, object?, bool)

Verifies that an object is of the given type.

IsType<T>(object?)

Verifies that an object is exactly the given type (and not a derived type).

IsType<T>(object?, bool)

Verifies that an object of is the given type.

Matches(string, string?)

Verifies that a string matches a regular expression.

Matches(Regex, string?)

Verifies that a string matches a regular expression.

Multiple(params Action[])

Runs multiple checks, collecting the exceptions from each one, and then bundles all failures up into a single assertion failure.

MultipleAsync(params Func<Task>[])

Asynchronously runs multiple checks, collecting the exceptions from each one, and then bundles all failures up into a single assertion failure.

NotEmpty(IEnumerable)

Verifies that a collection is not empty.

NotEqual(decimal, decimal, int)

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

NotEqual(double, double, double)

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

NotEqual(double, double, int)

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

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

NotEqual(float, float, int)

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

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

NotEqual(float, float, float)

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

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

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

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

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

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.

NotEqual<T>(T, T)

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

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

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

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

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

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

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

NotInRange<T>(T, T, T)

Verifies that a value is not within a given range, using the default comparer.

NotInRange<T>(T, T, T, IComparer<T>)

Verifies that a value is not within a given range, using a comparer.

NotNull(object?)

Verifies that an object reference is not null.

NotNull<T>(T?)

Verifies that a nullable struct value is not null.

NotRaisedAny(Action<Action>, Action<Action>, Action)

Verifies that an event is not raised.

NotRaisedAnyAsync(Action<Action>, Action<Action>, Func<Task>)

Verifies that an event is not raised.

NotRaisedAnyAsync<T>(Action<Action<T>>, Action<Action<T>>, Func<Task>)

Verifies that an event with the exact or a derived event args is not raised.

NotRaisedAnyAsync<T>(Action<EventHandler<T>>, Action<EventHandler<T>>, Func<Task>)

Verifies that an event with the exact or a derived event args is not raised.

NotRaisedAny<T>(Action<Action<T>>, Action<Action<T>>, Action)

Verifies that an event with the exact or a derived event args is not raised.

NotRaisedAny<T>(Action<EventHandler<T>>, Action<EventHandler<T>>, Action)

Verifies that an event with the exact or a derived event args is not raised.

NotSame(object?, object?)

Verifies that two objects are not the same instance.

NotStrictEqual<T>(T, T)

Verifies that two objects are strictly not equal, using the type's default comparer.

Null(object?)

Verifies that an object reference is null.

Null<T>(T?)

Verifies that a nullable struct value is null.

ProperSubset<T>(ISet<T>, ISet<T>?)

Verifies that a set is a proper subset of another set.

ProperSuperset<T>(ISet<T>, ISet<T>?)

Verifies that a set is a proper superset of another set.

PropertyChanged(INotifyPropertyChanged, string, Action)

Verifies that the provided object raised PropertyChanged as a result of executing the given test code.

PropertyChangedAsync(INotifyPropertyChanged, string, Func<Task>)

Verifies that the provided object raised PropertyChanged as a result of executing the given test code.

Raises(Action<Action>, Action<Action>, Action)

Verifies that an event is raised.

RaisesAny(Action<EventHandler>, Action<EventHandler>, Action)

Verifies that an event is raised.

RaisesAnyAsync(Action<EventHandler>, Action<EventHandler>, Func<Task>)

Verifies that an event is raised.

RaisesAnyAsync<T>(Action<Action<T>>, Action<Action<T>>, Func<Task>)

Verifies that an event with the exact or a derived event args is raised.

RaisesAnyAsync<T>(Action<EventHandler<T>>, Action<EventHandler<T>>, Func<Task>)

Verifies that an event with the exact or a derived event args is raised.

RaisesAny<T>(Action<Action<T>>, Action<Action<T>>, Action)

Verifies that an event with the exact or a derived event args is raised.

RaisesAny<T>(Action<EventHandler<T>>, Action<EventHandler<T>>, Action)

Verifies that an event with the exact or a derived event args is raised.

RaisesAsync(Action<Action>, Action<Action>, Func<Task>)

Verifies that an event is raised.

RaisesAsync<T>(Action<Action<T>>, Action<Action<T>>, Func<Task>)

Verifies that an event with the exact event args (and not a derived type) is raised.

RaisesAsync<T>(Action<EventHandler<T>>, Action<EventHandler<T>>, Func<Task>)

Verifies that an event with the exact event args (and not a derived type) is raised.

Raises<T>(Action<Action<T>>, Action<Action<T>>, Action)

Verifies that an event with the exact event args is raised.

Raises<T>(Action<EventHandler<T>>, Action<EventHandler<T>>, Action)

Verifies that an event with the exact event args is raised.

Raises<T>(Func<RaisedEvent<T>?>, Action, Action, Action)

Verifies that an event with the exact event args is raised.

RecordException(Action)

Records any exception which is thrown by the given code.

RecordException(Func<object?>, string)

Records any exception which is thrown by the given code that has a return value. Generally used for testing property accessors.

RecordExceptionAsync(Func<Task>)

Records any exception which is thrown by the given task.

Same(object?, object?)

Verifies that two objects are the same instance.

Single(IEnumerable)

Verifies that the given collection contains only a single element of the given type.

Single(IEnumerable, object?)

Verifies that the given collection contains only a single element of the given value. The collection may or may not contain other values.

Single<T>(IEnumerable<T>)

Verifies that the given collection contains only a single element of the given type.

Single<T>(IEnumerable<T>, Predicate<T>)

Verifies that the given collection contains only a single element of the given type which matches the given predicate. The collection may or may not contain other values which do not match the given predicate.

Skip(string)

Skips the current test. Used when determining whether a test should be skipped happens at runtime rather than at discovery time.

SkipUnless(bool, string)

Will skip the current test unless condition evaluates to true.

SkipWhen(bool, string)

Will skip the current test when condition evaluates to true.

StartsWith(Memory<char>, Memory<char>)

Verifies that a string starts with a given sub-string, using the current culture.

StartsWith(Memory<char>, Memory<char>, StringComparison)

Verifies that a string starts with a given sub-string, using the given comparison type.

StartsWith(Memory<char>, ReadOnlyMemory<char>)

Verifies that a string starts with a given sub-string, using the current culture.

StartsWith(Memory<char>, ReadOnlyMemory<char>, StringComparison)

Verifies that a string starts with a given sub-string, using the given comparison type.

StartsWith(ReadOnlyMemory<char>, Memory<char>)

Verifies that a string starts with a given sub-string, using the current culture.

StartsWith(ReadOnlyMemory<char>, Memory<char>, StringComparison)

Verifies that a string starts with a given sub-string, using the given comparison type.

StartsWith(ReadOnlyMemory<char>, ReadOnlyMemory<char>)

Verifies that a string starts with a given sub-string, using the default StringComparison.CurrentCulture comparison type.

StartsWith(ReadOnlyMemory<char>, ReadOnlyMemory<char>, StringComparison)

Verifies that a string starts with a given sub-string, using the given comparison type.

StartsWith(ReadOnlySpan<char>, ReadOnlySpan<char>)

Verifies that a string starts with a given sub-string, using the current culture.

StartsWith(ReadOnlySpan<char>, ReadOnlySpan<char>, StringComparison)

Verifies that a string starts with a given sub-string, using the given comparison type.

StartsWith(ReadOnlySpan<char>, Span<char>)

Verifies that a string starts with a given sub-string, using the current culture.

StartsWith(ReadOnlySpan<char>, Span<char>, StringComparison)

Verifies that a string starts with a given sub-string, using the given comparison type.

StartsWith(Span<char>, ReadOnlySpan<char>)

Verifies that a string starts with a given sub-string, using the current culture.

StartsWith(Span<char>, ReadOnlySpan<char>, StringComparison)

Verifies that a string starts with a given sub-string, using the given comparison type.

StartsWith(Span<char>, Span<char>)

Verifies that a string starts with a given sub-string, using the current culture.

StartsWith(Span<char>, Span<char>, StringComparison)

Verifies that a string starts with a given sub-string, using the given comparison type.

StartsWith(string?, string?)

Verifies that a string starts with a given string, using the current culture.

StartsWith(string?, string?, StringComparison)

Verifies that a string starts with a given sub-string, using the given comparison type.

StrictEqual<T>(T, T)

Verifies that two objects are strictly equal, using the type's default comparer.

Subset<T>(ISet<T>, ISet<T>?)

Verifies that a set is a subset of another set.

Superset<T>(ISet<T>, ISet<T>?)

Verifies that a set is a superset of another set.

Throws(Type, Action)

Verifies that the exact exception is thrown (and not a derived exception type).

Throws(Type, Action, Func<Exception, string?>)

Verifies that the exact exception is thrown (and not a derived exception type).

Throws(Type, Func<object?>)

Verifies that the exact exception is thrown (and not a derived exception type). Generally used to test property accessors.

Throws(Type, Func<object?>, Func<Exception, string?>)

Verifies that the exact exception is thrown (and not a derived exception type). Generally used to test property accessors.

ThrowsAnyAsync<T>(Func<Task>)

Verifies that the exact exception or a derived exception type is thrown.

ThrowsAnyAsync<T>(Func<Task>, Func<T, string?>)

Verifies that the exact exception or a derived exception type is thrown.

ThrowsAny<T>(Action)

Verifies that the exact exception or a derived exception type is thrown.

ThrowsAny<T>(Action, Func<T, string?>)

Verifies that the exact exception or a derived exception type is thrown.

ThrowsAny<T>(Func<object?>)

Verifies that the exact exception or a derived exception type is thrown. Generally used to test property accessors.

ThrowsAny<T>(Func<object?>, Func<T, string?>)

Verifies that the exact exception or a derived exception type is thrown. Generally used to test property accessors.

ThrowsAsync(Type, Func<Task>)

Verifies that the exact exception is thrown (and not a derived exception type).

ThrowsAsync(Type, Func<Task>, Func<Exception, string?>)

Verifies that the exact exception is thrown (and not a derived exception type).

ThrowsAsync<T>(Func<Task>)

Verifies that the exact exception is thrown (and not a derived exception type).

ThrowsAsync<T>(Func<Task>, Func<T, string?>)

Verifies that the exact exception is thrown (and not a derived exception type).

ThrowsAsync<T>(string?, Func<Task>)

Verifies that the exact exception is thrown (and not a derived exception type), where the exception derives from ArgumentException and has the given parameter name.

Throws<T>(Action)

Verifies that the exact exception is thrown (and not a derived exception type).

Throws<T>(Action, Func<T, string?>)

Verifies that the exact exception is thrown (and not a derived exception type).

Throws<T>(Func<object?>)

Verifies that the exact exception is thrown (and not a derived exception type). Generally used to test property accessors.

Throws<T>(Func<object?>, Func<T, string?>)

Verifies that the exact exception is thrown (and not a derived exception type). Generally used to test property accessors.

Throws<T>(string?, Action)

Verifies that the exact exception is thrown (and not a derived exception type), where the exception derives from ArgumentException and has the given parameter name.

Throws<T>(string?, Func<object?>)

Verifies that the exact exception is thrown (and not a derived exception type), where the exception derives from ArgumentException and has the given parameter name.

True(bool)

Verifies that an expression is true.

True(bool, string?)

Verifies that an expression is true.

True(bool?)

Verifies that an expression is true.

True(bool?, string?)

Verifies that an expression is true.