Assert Class

public static class Assert

No documentation is available.

Properties

NameDescription
ArchitectureGets the assertions on the dependencies of the types of an ArchitectureModel, such as Assert.Architecture.DoesNotDependOn(domain, infrastructure).
FormatterOptionsGets or sets the options used to format assertion failure messages.

Gets the assertions on the dependencies of the types of an ArchitectureModel, such as Assert.Architecture.DoesNotDependOn(domain, infrastructure).

public static ArchitectureAssert Architecture { get; }

Property value

ArchitectureAssert

FormatterOptions

Assert.cs

Gets or sets the options used to format assertion failure messages.

public static FormatterOptions FormatterOptions { get; set; }

Property value

FormatterOptions

Remarks

These options are shared by the whole process. To change the options for a single test without affecting tests running in parallel, use Assert.UseFormatterOptions instead.

Methods

NameDescription
All(IEnumerable?, Action<object?, int>, string?, string?, string?)Asserts that all items in a non-generic enumerable satisfy the specified assertion.
All(IEnumerable?, Action<object?>, string?, string?, string?)Asserts that all items in a non-generic enumerable satisfy the specified assertion.
All<T>(IAsyncEnumerable<T>?, Action<T, int>, string?, string?, string?)Asserts that all items in an asynchronous sequence satisfy the specified assertion.
All<T>(IAsyncEnumerable<T>?, Action<T>, string?, string?, string?)Asserts that all items in an asynchronous sequence satisfy the specified assertion.
All<T>(IAsyncEnumerable<T>?, Func<T, int, Task>, string?, string?, string?)Asserts that all items in an asynchronous sequence satisfy the specified asynchronous assertion.
All<T>(IAsyncEnumerable<T>?, Func<T, Task>, string?, string?, string?)Asserts that all items in an asynchronous sequence satisfy the specified asynchronous assertion.
All<T>(IEnumerable<T>?, Action<T, int>, string?, string?, string?)Asserts that all items in an enumerable satisfy the specified assertion.
All<T>(IEnumerable<T>?, Action<T>, string?, string?, string?)Asserts that all items in an enumerable satisfy the specified assertion.
All<T>(IEnumerable<T>?, Func<T, bool>, string?, string?, string?)Asserts that all items in an enumerable satisfy the specified predicate.
All<T>(ReadOnlySpan<T>, Action<T, int>, string?, string?, string?)Asserts that all items in a span satisfy the specified assertion.
All<T>(ReadOnlySpan<T>, Action<T>, string?, string?, string?)Asserts that all items in a span satisfy the specified assertion.
All<T>(T[]?, Action<T, int>, string?, string?, string?)Asserts that an array is not null and all its items satisfy the specified assertion.
All<T>(T[]?, Action<T>, string?, string?, string?)Asserts that an array is not null and all its items satisfy the specified assertion.
All<T>(T[]?, Func<T, bool>, string?, string?, string?)Asserts that an array is not null and all its items satisfy the specified predicate.
Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, string?, string?)
Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, string?, string?)
Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, string?, string?)
Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, string?, string?)
Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, string?, string?)
Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, string?, string?)
Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, string?, string?)
Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, string?, string?)
Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, string?, string?)
Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, string?, string?)
Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, string?, string?)
Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, string?, string?)
Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, Action<T>, string?, string?)
Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, string?, string?)
Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, string?, string?)
Collection<T>(IEnumerable<T>?, Action<T>, string?, string?)
Collection<T>(IEnumerable<T>?, Action<T>[], string?, string?)
Collection<T>(IEnumerable<T>?, string?, string?)
Contains(char, string?, IEqualityComparer<char>?, string?, string?, string?)Asserts that a string contains the specified character.
Contains(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)Asserts that a non-generic enumerable contains the specified contiguous non-generic subsequence.
Contains(object?, IDictionary?, string?, string?, string?)Asserts that a non-generic dictionary contains the specified key and returns the associated value.
Contains(object?, IEnumerable?, string?, string?, string?)Asserts that a non-generic enumerable contains the specified value.
Contains(ReadOnlySpan<char>, ReadOnlySpan<char>, bool, string?, string?, string?)Asserts that a character span contains the specified substring.
Contains(ReadOnlySpan<char>, ReadOnlySpan<char>, StringComparison, string?, string?, string?)Asserts that a character span contains the specified substring.
Contains(string, IDictionary?, string?, string?, string?)Asserts that a non-generic dictionary contains the specified string key and returns the associated value.
Contains(string, string?, bool, string?, string?, string?)Asserts that a string contains the specified substring.
Contains(string, string?, StringComparison, string?, string?, string?)Asserts that a string contains the specified substring.
Contains<T>(IEnumerable<T>, IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)Asserts that an asynchronous sequence contains the specified contiguous subsequence.
Contains<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)Asserts that an enumerable contains the specified contiguous subsequence.
Contains<T>(IEnumerable<T>?, Func<T, bool>, string?, string?, string?)Asserts that an enumerable contains at least one item that matches the specified predicate.
Contains<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)Asserts that a span contains the specified subsequence.
Contains<T>(T, ICollection<T>?, string?, string?, string?)Asserts that an enumerable contains the specified value.
Contains<T>(T, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)Asserts that an enumerable contains the specified value.
Contains<T>(T, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)Asserts that a span contains the specified value.
Contains<T>(T, T[]?, IEqualityComparer<T>?, string?, string?, string?)Asserts that an array contains the specified value.
Contains<TKey, TValue>(TKey, Dictionary<TKey, TValue>?, string?, string?, string?)Asserts that a dictionary contains the specified key and returns the associated value.
Contains<TKey, TValue>(TKey, IEnumerable<KeyValuePair<TKey, TValue>>?, IEqualityComparer<TKey>?, string?, string?, string?)Asserts that a dictionary-like collection contains the specified key and returns the associated value.
Distinct(IEnumerable?, IEqualityComparer?, string?, string?)Asserts that a non-generic enumerable does not contain duplicate items.
Distinct(string?, string?, string?)Asserts that a string does not contain duplicate characters.
Distinct<T>(IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?)Asserts that an asynchronous sequence does not contain duplicate items.
Distinct<T>(IEnumerable<T>?, IEqualityComparer<T>?, string?, string?)Asserts that an enumerable does not contain duplicate items.
Distinct<T>(ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?)Asserts that a span does not contain duplicate items.
Distinct<T>(T[]?, IEqualityComparer<T>?, string?, string?)Asserts that an array is not null and does not contain duplicate items.
DoesNotAll<T>(IEnumerable<T>?, Func<T, bool>, string?, string?, string?)Asserts that not all items in an enumerable satisfy the specified predicate (i.e., at least one item does not).
DoesNotContain(char, string?, IEqualityComparer<char>?, string?, string?, string?)
DoesNotContain(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)
DoesNotContain(object?, IDictionary?, string?, string?, string?)
DoesNotContain(object?, IEnumerable?, string?, string?, string?)
DoesNotContain(ReadOnlySpan<char>, ReadOnlySpan<char>, bool, string?, string?, string?)
DoesNotContain(ReadOnlySpan<char>, ReadOnlySpan<char>, StringComparison, string?, string?, string?)
DoesNotContain(string, IDictionary?, string?, string?, string?)
DoesNotContain(string, string?, bool, string?, string?, string?)
DoesNotContain(string, string?, StringComparison, string?, string?, string?)
DoesNotContain<T>(IEnumerable<T>, IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
DoesNotContain<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
DoesNotContain<T>(IEnumerable<T>?, Func<T, bool>, string?, string?, string?)
DoesNotContain<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)
DoesNotContain<T>(T, ICollection<T>?, string?, string?, string?)
DoesNotContain<T>(T, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
DoesNotContain<T>(T, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)
DoesNotContain<T>(T, T[]?, IEqualityComparer<T>?, string?, string?, string?)
DoesNotContain<TKey, TValue>(TKey, Dictionary<TKey, TValue>?, string?, string?, string?)
DoesNotContain<TKey, TValue>(TKey, IEnumerable<KeyValuePair<TKey, TValue>>?, IEqualityComparer<TKey>?, string?, string?, string?)
DoesNotEndWith(char, string?, IEqualityComparer<char>?, string?, string?, string?)
DoesNotEndWith(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)
DoesNotEndWith(object?, IEnumerable?, string?, string?, string?)
DoesNotEndWith(ReadOnlySpan<char>, ReadOnlySpan<char>, bool, string?, string?, string?)
DoesNotEndWith(ReadOnlySpan<char>, ReadOnlySpan<char>, StringComparison, string?, string?, string?)
DoesNotEndWith(string, string?, bool, string?, string?, string?)
DoesNotEndWith(string, string?, StringComparison, string?, string?, string?)
DoesNotEndWith<T>(IEnumerable<T>, IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
DoesNotEndWith<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
DoesNotEndWith<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)
DoesNotEndWith<T>(T, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
DoesNotEndWith<T>(T, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)
DoesNotEndWith<T>(T, T[]?, IEqualityComparer<T>?, string?, string?, string?)
DoesNotHaveCount(int, IEnumerable?, string?, string?)
DoesNotHaveCount(int, string?, string?, string?)
DoesNotHaveCount<T>(int, IAsyncEnumerable<T>?, string?, string?)
DoesNotHaveCount<T>(int, IEnumerable<T>?, string?, string?)
DoesNotHaveCount<T>(int, ReadOnlySpan<T>, string?, string?)
DoesNotHaveCount<T>(int, T[]?, string?, string?)
DoesNotMatch(string, string, string?, string?, string?)Asserts that the specified regular expression pattern does not match the actual value.
DoesNotMatch(Regex, string, string?, string?, string?)Asserts that the specified regular expression does not match the actual value.
DoesNotRaise(Action<EventHandler>, Action<EventHandler>, Action, string?, string?)
DoesNotRaise(Action<EventHandler>, Action<EventHandler>, Func<Task>, string?, string?)
DoesNotRaise(Action<EventHandler>, Action<EventHandler>, Func<ValueTask>, string?, string?)
DoesNotRaise<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Action, string?, string?)
DoesNotRaise<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<Task>, string?, string?)
DoesNotRaise<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<ValueTask>, string?, string?)
DoesNotRaiseAny(Action<EventHandler>, Action<EventHandler>, Action, string?, string?)
DoesNotRaiseAny(Action<EventHandler>, Action<EventHandler>, Func<Task>, string?, string?)
DoesNotRaiseAny(Action<EventHandler>, Action<EventHandler>, Func<ValueTask>, string?, string?)
DoesNotRaiseAny<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Action, string?, string?)
DoesNotRaiseAny<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<Task>, string?, string?)
DoesNotRaiseAny<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<ValueTask>, string?, string?)
DoesNotStartWith(char, string?, IEqualityComparer<char>?, string?, string?, string?)
DoesNotStartWith(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)
DoesNotStartWith(object?, IEnumerable?, string?, string?, string?)
DoesNotStartWith(ReadOnlySpan<char>, ReadOnlySpan<char>, bool, string?, string?, string?)
DoesNotStartWith(ReadOnlySpan<char>, ReadOnlySpan<char>, StringComparison, string?, string?, string?)
DoesNotStartWith(string, string?, bool, string?, string?, string?)
DoesNotStartWith(string, string?, StringComparison, string?, string?, string?)
DoesNotStartWith<T>(IEnumerable<T>, IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
DoesNotStartWith<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
DoesNotStartWith<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)
DoesNotStartWith<T>(T, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
DoesNotStartWith<T>(T, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)
DoesNotStartWith<T>(T, T[]?, IEqualityComparer<T>?, string?, string?, string?)
DoesNotThrow(Action, string?, string?)
DoesNotThrow(Func<object?>, string?, string?)
DoesNotThrow(Func<Task>, string?, string?)
DoesNotThrow(Func<ValueTask>, string?, string?)
DoesNotThrow(Type, Action, string?, string?)
DoesNotThrow(Type, Func<object?>, string?, string?)
DoesNotThrow(Type, Func<Task>, string?, string?)
DoesNotThrow(Type, Func<ValueTask>, string?, string?)
DoesNotThrow<T>(Action, string?, string?)
DoesNotThrow<T>(Func<object?>, string?, string?)
DoesNotThrow<T>(Func<Task>, string?, string?)
DoesNotThrow<T>(Func<ValueTask>, string?, string?)
DoesNotThrowAny(Type, Action, string?, string?)
DoesNotThrowAny(Type, Func<object?>, string?, string?)
DoesNotThrowAny(Type, Func<Task>, string?, string?)
DoesNotThrowAny(Type, Func<ValueTask>, string?, string?)
DoesNotThrowAny<T>(Action, string?, string?)
DoesNotThrowAny<T>(Func<object?>, string?, string?)
DoesNotThrowAny<T>(Func<Task>, string?, string?)
DoesNotThrowAny<T>(Func<ValueTask>, string?, string?)
Empty(IEnumerable?, string?, string?)Asserts that a non-generic enumerable is not null and is empty.
Empty(string?, string?, string?)Asserts that a string is not null and is empty.
Empty<T>(IAsyncEnumerable<T>?, string?, string?)Asserts that an asynchronous sequence is not null and is empty.
Empty<T>(IEnumerable<T>?, string?, string?)Asserts that an enumerable is not null and is empty.
Empty<T>(ReadOnlySpan<T>, string?, string?)Asserts that a span is empty.
Empty<T>(T[]?, string?, string?)Asserts that an array is not null and is empty.
EndsWith(char, string?, IEqualityComparer<char>?, string?, string?, string?)Asserts that a string ends with the specified character.
EndsWith(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)Asserts that a non-generic enumerable ends with the specified non-generic suffix.
EndsWith(object?, IEnumerable?, string?, string?, string?)Asserts that a non-generic enumerable ends with the specified value.
EndsWith(ReadOnlySpan<char>, ReadOnlySpan<char>, bool, string?, string?, string?)Asserts that a character span ends with the specified suffix.
EndsWith(ReadOnlySpan<char>, ReadOnlySpan<char>, StringComparison, string?, string?, string?)Asserts that a character span ends with the specified suffix.
EndsWith(string, string?, bool, string?, string?, string?)Asserts that a string ends with the specified suffix.
EndsWith(string, string?, StringComparison, string?, string?, string?)Asserts that a string ends with the specified suffix.
EndsWith<T>(IEnumerable<T>, IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)Asserts that an asynchronous sequence ends with the specified suffix.
EndsWith<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)Asserts that an enumerable ends with the specified suffix.
EndsWith<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)Asserts that a span ends with the specified suffix.
EndsWith<T>(T, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)Asserts that an enumerable ends with the specified value.
EndsWith<T>(T, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)Asserts that a span ends with the specified value.
EndsWith<T>(T, T[]?, IEqualityComparer<T>?, string?, string?, string?)Asserts that an array ends with the specified value.
Equal(IEnumerable?, IEnumerable?, IEqualityComparer?, string?, string?, string?)
Equal(IEnumerable?, IEnumerable?, string?, string?, string?)
Equal(DateTime, DateTime, TimeSpan, string?, string?, string?)
Equal(DateTimeOffset, DateTimeOffset, TimeSpan, string?, string?, string?)
Equal(decimal, decimal, decimal, string?, string?, string?)
Equal(decimal, decimal, int, MidpointRounding, string?, string?, string?)
Equal(decimal, decimal, int, string?, string?, string?)
Equal(double, double, double, string?, string?, string?)
Equal(double, double, int, MidpointRounding, string?, string?, string?)
Equal(double, double, int, string?, string?, string?)
Equal(Half, Half, Half, string?, string?, string?)
Equal(object?, object?, string?, string?, string?)
Equal(ReadOnlySpan<char>, ReadOnlySpan<char>, bool, bool, string?, string?, string?)
Equal(float, float, int, MidpointRounding, string?, string?, string?)
Equal(float, float, int, string?, string?, string?)
Equal(float, float, float, string?, string?, string?)
Equal(string?, string?, bool, bool, string?, string?, string?)
Equal<T>(IAsyncEnumerable<T>?, IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Equal<T>(IAsyncEnumerable<T>?, IAsyncEnumerable<T>?, string?, string?, string?)
Equal<T>(IAsyncEnumerable<T>?, IEnumerable<T>?, string?, string?, string?)
Equal<T>(IEnumerable<T>?, IAsyncEnumerable<T>?, string?, string?, string?)
Equal<T>(IEnumerable<T>?, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Equal<T>(IEnumerable<T>?, IEnumerable<T>?, string?, string?, string?)
Equal<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, string?, string?, string?)
Equal<T>(T, T, IEqualityComparer<T>?, string?, string?, string?)Verifies that two values are equal according to comparer.
Equal<T>(T, T?, string?, string?, string?)
Equal<T>(T, T, T, string?, string?, string?)
Equal<T>(T, T, string?, string?, string?)Verifies that two values of a ref struct type are equal according to IEquatable<T>.Equals.
Equal<T>(T[]?, T[]?, string?, string?, string?)
Equal<TExpected, TActual>(IAsyncEnumerable<TExpected>?, IAsyncEnumerable<TActual>?, string?, string?, string?)
Equal<TExpected, TActual>(IEnumerable<TExpected>?, IEnumerable<TActual>?, string?, string?, string?)
Equal<TExpected, TActual>(ReadOnlyMemory<TExpected>, ReadOnlyMemory<TActual>, string?, string?, string?)
Equal<TExpected, TActual>(ReadOnlySpan<TExpected>, ReadOnlySpan<TActual>, string?, string?, string?)
EqualUnordered(IEnumerable?, IEnumerable?, IEqualityComparer?, string?, string?, string?)
EqualUnordered(IEnumerable?, IEnumerable?, string?, string?, string?)
EqualUnordered<T>(IAsyncEnumerable<T>?, IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)Asserts that two sequences contain the same items, regardless of their order.
EqualUnordered<T>(IAsyncEnumerable<T>?, IAsyncEnumerable<T>?, string?, string?, string?)Asserts that two sequences contain the same items, regardless of their order.
EqualUnordered<T>(IEnumerable<T>?, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)Asserts that two sequences contain the same items, regardless of their order.
EqualUnordered<T>(IEnumerable<T>?, IEnumerable<T>?, string?, string?, string?)Asserts that two sequences contain the same items, regardless of their order.
EqualUnordered<TExpected, TActual>(IAsyncEnumerable<TExpected>?, IAsyncEnumerable<TActual>?, string?, string?, string?)
EqualUnordered<TExpected, TActual>(IEnumerable<TExpected>?, IEnumerable<TActual>?, string?, string?, string?)
Equals(object?, object?)
Equivalent(object?, object?, EquivalentOptions?, string?, string?, string?)
Equivalent(object?, object?, string?, string?, string?)
Fail(string?)Fails the assertion with the specified message.
False(bool, string?, string?)Asserts that a condition is false. If the condition is true, an AssertionException is thrown.
False(bool?, string?, string?)Asserts that a nullable condition is false. If the condition is true or null, an AssertionException is thrown.
HasCount(int, IEnumerable?, string?, string?)
HasCount(int, string?, string?, string?)
HasCount<T>(int, IAsyncEnumerable<T>?, string?, string?)
HasCount<T>(int, IEnumerable<T>?, string?, string?)
HasCount<T>(int, ReadOnlySpan<T>, string?, string?)
HasCount<T>(int, T[]?, string?, string?)
HasCountGreaterThan(int, IEnumerable?, string?, string?)
HasCountGreaterThan(int, string?, string?, string?)
HasCountGreaterThan<T>(int, IAsyncEnumerable<T>?, string?, string?)
HasCountGreaterThan<T>(int, IEnumerable<T>?, string?, string?)
HasCountGreaterThan<T>(int, ReadOnlySpan<T>, string?, string?)
HasCountGreaterThan<T>(int, T[]?, string?, string?)
HasCountGreaterThanOrEqual(int, IEnumerable?, string?, string?)
HasCountGreaterThanOrEqual(int, string?, string?, string?)
HasCountGreaterThanOrEqual<T>(int, IAsyncEnumerable<T>?, string?, string?)
HasCountGreaterThanOrEqual<T>(int, IEnumerable<T>?, string?, string?)
HasCountGreaterThanOrEqual<T>(int, ReadOnlySpan<T>, string?, string?)
HasCountGreaterThanOrEqual<T>(int, T[]?, string?, string?)
HasCountLessThan(int, IEnumerable?, string?, string?)
HasCountLessThan(int, string?, string?, string?)
HasCountLessThan<T>(int, IAsyncEnumerable<T>?, string?, string?)
HasCountLessThan<T>(int, IEnumerable<T>?, string?, string?)
HasCountLessThan<T>(int, ReadOnlySpan<T>, string?, string?)
HasCountLessThan<T>(int, T[]?, string?, string?)
HasCountLessThanOrEqual(int, IEnumerable?, string?, string?)
HasCountLessThanOrEqual(int, string?, string?, string?)
HasCountLessThanOrEqual<T>(int, IAsyncEnumerable<T>?, string?, string?)
HasCountLessThanOrEqual<T>(int, IEnumerable<T>?, string?, string?)
HasCountLessThanOrEqual<T>(int, ReadOnlySpan<T>, string?, string?)
HasCountLessThanOrEqual<T>(int, T[]?, string?, string?)
InRange<T>(T, T, T, IComparer<T>?, string?, string?)Asserts that a value is inside the specified inclusive range.
InRange<T>(T, T, T, string?, string?, string?, string?)Asserts that a value of a ref struct type is inside the specified inclusive range, according to IComparable<T>.CompareTo.
IsAssignableTo(Type, object?, string?, string?)Asserts that an object can be assigned to the specified type.
IsAssignableTo<T>(object?, string?, string?)Asserts that an object can be assigned to the specified type.
IsNotAssignableTo(Type, object?, string?, string?)
IsNotAssignableTo<T>(object?, string?, string?)
IsNotType(Type, object?, string?, string?)
IsNotType<T>(object?, string?, string?)
IsType(Type, object?, string?, string?)Asserts that an object is exactly of the specified type.
IsType<T>(object?, string?, string?)Asserts that an object is exactly of the specified type.
Matches(string, string, string?, string?, string?)Asserts that the specified regular expression pattern matches the actual value.
Matches(Regex, string, string?, string?, string?)Asserts that the specified regular expression matches the actual value.
NotDistinct(IEnumerable?, IEqualityComparer?, string?, string?)
NotDistinct(string?, string?, string?)
NotDistinct<T>(IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?)
NotDistinct<T>(IEnumerable<T>?, IEqualityComparer<T>?, string?, string?)
NotDistinct<T>(ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?)
NotDistinct<T>(T[]?, IEqualityComparer<T>?, string?, string?)
NotEmpty(IEnumerable?, string?, string?)
NotEmpty(string?, string?, string?)
NotEmpty<T>(IAsyncEnumerable<T>?, string?, string?)
NotEmpty<T>(IEnumerable<T>?, string?, string?)
NotEmpty<T>(ReadOnlySpan<T>, string?, string?)
NotEmpty<T>(T[]?, string?, string?)
NotEqual(IEnumerable?, IEnumerable?, IEqualityComparer?, string?, string?, string?)
NotEqual(IEnumerable?, IEnumerable?, string?, string?, string?)
NotEqual(DateTime, DateTime, TimeSpan, string?, string?, string?)
NotEqual(DateTimeOffset, DateTimeOffset, TimeSpan, string?, string?, string?)
NotEqual(decimal, decimal, decimal, string?, string?, string?)
NotEqual(decimal, decimal, int, MidpointRounding, string?, string?, string?)
NotEqual(decimal, decimal, int, string?, string?, string?)
NotEqual(double, double, double, string?, string?, string?)
NotEqual(double, double, int, MidpointRounding, string?, string?, string?)
NotEqual(double, double, int, string?, string?, string?)
NotEqual(Half, Half, Half, string?, string?, string?)
NotEqual(ReadOnlySpan<char>, ReadOnlySpan<char>, bool, bool, string?, string?, string?)
NotEqual(float, float, int, MidpointRounding, string?, string?, string?)
NotEqual(float, float, int, string?, string?, string?)
NotEqual(float, float, float, string?, string?, string?)
NotEqual(string?, string?, bool, bool, string?, string?, string?)
NotEqual<T>(IAsyncEnumerable<T>?, IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
NotEqual<T>(IAsyncEnumerable<T>?, IAsyncEnumerable<T>?, string?, string?, string?)
NotEqual<T>(IEnumerable<T>?, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
NotEqual<T>(IEnumerable<T>?, IEnumerable<T>?, string?, string?, string?)
NotEqual<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, string?, string?, string?)
NotEqual<T>(T, T, IEqualityComparer<T>?, string?, string?, string?)Verifies that two values are not equal according to comparer.
NotEqual<T>(T, T?, string?, string?, string?)
NotEqual<T>(T, T, T, string?, string?, string?)
NotEqual<T>(T, T, string?, string?, string?)Verifies that two values of a ref struct type are not equal according to IEquatable<T>.Equals.
NotEqual<TExpected, TActual>(IAsyncEnumerable<TExpected>?, IAsyncEnumerable<TActual>?, string?, string?, string?)
NotEqual<TExpected, TActual>(IEnumerable<TExpected>?, IEnumerable<TActual>?, string?, string?, string?)
NotEqual<TExpected, TActual>(ReadOnlyMemory<TExpected>, ReadOnlyMemory<TActual>, string?, string?, string?)
NotEqual<TExpected, TActual>(ReadOnlySpan<TExpected>, ReadOnlySpan<TActual>, string?, string?, string?)
NotEqual<TExpected, TActual>(TExpected, TActual?, string?, string?, string?)
NotEqualUnordered(IEnumerable?, IEnumerable?, IEqualityComparer?, string?, string?, string?)
NotEqualUnordered(IEnumerable?, IEnumerable?, string?, string?, string?)
NotEqualUnordered<T>(IAsyncEnumerable<T>?, IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)Asserts that two sequences do not contain the same items, regardless of their order.
NotEqualUnordered<T>(IAsyncEnumerable<T>?, IAsyncEnumerable<T>?, string?, string?, string?)Asserts that two sequences do not contain the same items, regardless of their order.
NotEqualUnordered<T>(IEnumerable<T>?, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)Asserts that two sequences do not contain the same items, regardless of their order.
NotEqualUnordered<T>(IEnumerable<T>?, IEnumerable<T>?, string?, string?, string?)Asserts that two sequences do not contain the same items, regardless of their order.
NotEqualUnordered<TExpected, TActual>(IAsyncEnumerable<TExpected>?, IAsyncEnumerable<TActual>?, string?, string?, string?)
NotEqualUnordered<TExpected, TActual>(IEnumerable<TExpected>?, IEnumerable<TActual>?, string?, string?, string?)
NotEquivalent(object?, object?, EquivalentOptions?, string?, string?, string?)
NotEquivalent(object?, object?, string?, string?, string?)
NotInRange<T>(T, T, T, IComparer<T>?, string?, string?)
NotInRange<T>(T, T, T, string?, string?, string?, string?)Asserts that a value of a ref struct type is outside the specified inclusive range, according to IComparable<T>.CompareTo.
NotNull(object?, string?, string?)Asserts that a value is not null.
NotNull<T>(T?, string?, string?)
NotNull<T>(T?, string?, string?)Asserts that a reference is not null.
NotProperSubset(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)Asserts that actual is not a proper subset of expectedSuperset. This is the exact complement of ProperSubset, so a null actual succeeds.
NotProperSubset<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)Asserts that actual is not a proper subset of expectedSuperset. This is the exact complement of ProperSubset, so a null actual succeeds.
NotProperSuperset(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)Asserts that actual is not a proper superset of expectedSubset. This is the exact complement of ProperSuperset, so a null actual succeeds.
NotProperSuperset<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)Asserts that actual is not a proper superset of expectedSubset. This is the exact complement of ProperSuperset, so a null actual succeeds.
NotRaisedAny<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Action, string?, string?)Compatibility shim for xUnit. Asserts that no event is raised.
NotRaisedAnyAsync<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<Task>, string?, string?)Compatibility shim for xUnit. Asserts that no event is raised by the asynchronous action.
NotSame(object?, object?, string?, string?, string?)
Null(object?, string?, string?)Asserts that an object is null.
Null<T>(T?, string?, string?)
ProperSubset(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)Asserts that actual is a proper subset of expectedSuperset.
ProperSubset<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)Asserts that actual is a proper subset of expectedSuperset, like actual.IsProperSubsetOf(expectedSuperset).
ProperSuperset(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)Asserts that actual is a proper superset of expectedSubset.
ProperSuperset<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)Asserts that actual is a proper superset of expectedSubset, like actual.IsProperSupersetOf(expectedSubset).
Raise(Action<EventHandler>, Action<EventHandler>, Action, string?, string?)
Raise(Action<EventHandler>, Action<EventHandler>, Func<Task>, string?, string?)
Raise(Action<EventHandler>, Action<EventHandler>, Func<ValueTask>, string?, string?)
Raise<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Action, string?, string?)
Raise<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<Task>, string?, string?)
Raise<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<ValueTask>, string?, string?)
RaiseAny(Action<EventHandler>, Action<EventHandler>, Action, string?, string?)
RaiseAny(Action<EventHandler>, Action<EventHandler>, Func<Task>, string?, string?)
RaiseAny(Action<EventHandler>, Action<EventHandler>, Func<ValueTask>, string?, string?)
RaiseAny<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Action, string?, string?)
RaiseAny<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<Task>, string?, string?)
RaiseAny<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<ValueTask>, string?, string?)
Raises<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Action, string?, string?)Compatibility shim for xUnit. Asserts that an event with exactly the specified event args type is raised.
RaisesAny(Action<EventHandler>, Action<EventHandler>, Action, string?, string?)Compatibility shim for xUnit. Asserts that an event is raised.
RaisesAny<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Action, string?, string?)Compatibility shim for xUnit. Asserts that an event with an event args type assignable to the specified type is raised.
RaisesAnyAsync(Action<EventHandler>, Action<EventHandler>, Func<Task>, string?, string?)Compatibility shim for xUnit. Asserts that an event is raised by the asynchronous action.
RaisesAnyAsync<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<Task>, string?, string?)Compatibility shim for xUnit. Asserts that an event with an event args type assignable to the specified type is raised by the asynchronous action.
RaisesAsync<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<Task>, string?, string?)Compatibility shim for xUnit. Asserts that an event with exactly the specified event args type is raised by the asynchronous action.
ReferenceEquals(object?, object?)
Same(object?, object?, string?, string?, string?)Asserts that two objects refer to the same instance.
Single(IEnumerable?, string?, string?)Asserts that a non-generic enumerable contains a single item and returns it.
Single(ReadOnlySpan<char>, string?, string?)Asserts that a character span contains a single character and returns it.
Single(string?, string?, string?)Asserts that a string contains a single character and returns it.
Single<T>(IAsyncEnumerable<T>?, string?, string?)Asserts that an asynchronous sequence contains a single item and returns it.
Single<T>(IEnumerable<T>?, Func<T, bool>, string?, string?, string?)Asserts that an enumerable contains a single item matching the predicate and returns it.
Single<T>(IEnumerable<T>?, string?, string?)Asserts that an enumerable contains a single item and returns it.
Single<T>(ReadOnlySpan<T>, string?, string?)Asserts that a span contains a single item and returns it.
Single<T>(T[]?, string?, string?)Asserts that an array is not null, contains a single item and returns it.
StartsWith(char, string?, IEqualityComparer<char>?, string?, string?, string?)Asserts that a string starts with the specified character.
StartsWith(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)Asserts that a non-generic enumerable starts with the specified non-generic prefix.
StartsWith(object?, IEnumerable?, string?, string?, string?)Asserts that a non-generic enumerable starts with the specified value.
StartsWith(ReadOnlySpan<char>, ReadOnlySpan<char>, bool, string?, string?, string?)Asserts that a character span starts with the specified prefix.
StartsWith(ReadOnlySpan<char>, ReadOnlySpan<char>, StringComparison, string?, string?, string?)Asserts that a character span starts with the specified prefix.
StartsWith(string, string?, bool, string?, string?, string?)Asserts that a string starts with the specified prefix.
StartsWith(string, string?, StringComparison, string?, string?, string?)Asserts that a string starts with the specified prefix.
StartsWith<T>(IEnumerable<T>, IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)Asserts that an asynchronous sequence starts with the specified prefix.
StartsWith<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)Asserts that an enumerable starts with the specified prefix.
StartsWith<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)Asserts that a span starts with the specified prefix.
StartsWith<T>(T, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)Asserts that an enumerable starts with the specified value.
StartsWith<T>(T, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)Asserts that a span starts with the specified value.
StartsWith<T>(T, T[]?, IEqualityComparer<T>?, string?, string?, string?)Asserts that an array starts with the specified value.
Subset(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)Asserts that actual is a subset of expectedSuperset.
Subset<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)Asserts that actual is a subset of expectedSuperset, like actual.IsSubsetOf(expectedSuperset).
Superset(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)Asserts that actual is a superset of expectedSubset.
Superset<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)Asserts that actual is a superset of expectedSubset, like actual.IsSupersetOf(expectedSubset).
Throws(Type, Action, string?, string?)Asserts that the action throws an exception exactly of the specified type.
Throws(Type, Func<object?>, string?, string?)Asserts that the function throws an exception exactly of the specified type.
Throws(Type, Func<Task<object?>>, string?, string?)Asserts that the asynchronous function throws an exception exactly of the specified type.
Throws(Type, Func<Task>, string?, string?)Asserts that the asynchronous action throws an exception exactly of the specified type.
Throws(Type, Func<ValueTask<object?>>, string?, string?)Asserts that the asynchronous function throws an exception exactly of the specified type.
Throws(Type, Func<ValueTask>, string?, string?)Asserts that the asynchronous action throws an exception exactly of the specified type.
Throws<T>(Action, string?, string?)Asserts that the action throws an exception exactly of the specified type.
Throws<T>(Func<object?>, string?, string?)Asserts that the function throws an exception exactly of the specified type.
Throws<T>(Func<Task<object?>>, string?, string?)Asserts that the asynchronous function throws an exception exactly of the specified type.
Throws<T>(Func<Task>, string?, string?)Asserts that the asynchronous action throws an exception exactly of the specified type.
Throws<T>(Func<ValueTask<object?>>, string?, string?)Asserts that the asynchronous function throws an exception exactly of the specified type.
Throws<T>(Func<ValueTask>, string?, string?)Asserts that the asynchronous action throws an exception exactly of the specified type.
Throws<T>(string?, Action, string?, string?)Asserts that the action throws an exception exactly of the specified type, whose ArgumentException.ParamName is paramName.
Throws<T>(string?, Func<object?>, string?, string?)Asserts that the function throws an exception exactly of the specified type, whose ArgumentException.ParamName is paramName.
Throws<T>(string?, Func<Task<object?>>, string?, string?)Asserts that the asynchronous function throws an exception exactly of the specified type, whose ArgumentException.ParamName is paramName.
Throws<T>(string?, Func<Task>, string?, string?)Asserts that the asynchronous action throws an exception exactly of the specified type, whose ArgumentException.ParamName is paramName.
Throws<T>(string?, Func<ValueTask<object?>>, string?, string?)Asserts that the asynchronous function throws an exception exactly of the specified type, whose ArgumentException.ParamName is paramName.
Throws<T>(string?, Func<ValueTask>, string?, string?)Asserts that the asynchronous action throws an exception exactly of the specified type, whose ArgumentException.ParamName is paramName.
ThrowsAny(Type, Action, string?, string?)Asserts that the action throws an exception assignable to the specified type.
ThrowsAny(Type, Func<object?>, string?, string?)Asserts that the function throws an exception assignable to the specified type.
ThrowsAny(Type, Func<Task<object?>>, string?, string?)Asserts that the asynchronous function throws an exception assignable to the specified type.
ThrowsAny(Type, Func<Task>, string?, string?)Asserts that the asynchronous action throws an exception assignable to the specified type.
ThrowsAny(Type, Func<ValueTask<object?>>, string?, string?)Asserts that the asynchronous function throws an exception assignable to the specified type.
ThrowsAny(Type, Func<ValueTask>, string?, string?)Asserts that the asynchronous action throws an exception assignable to the specified type.
ThrowsAny<T>(Action, string?, string?)Asserts that the action throws an exception assignable to the specified type.
ThrowsAny<T>(Func<object?>, string?, string?)Asserts that the function throws an exception assignable to the specified type.
ThrowsAny<T>(Func<Task<object?>>, string?, string?)Asserts that the asynchronous function throws an exception assignable to the specified type.
ThrowsAny<T>(Func<Task>, string?, string?)Asserts that the asynchronous action throws an exception assignable to the specified type.
ThrowsAny<T>(Func<ValueTask<object?>>, string?, string?)Asserts that the asynchronous function throws an exception assignable to the specified type.
ThrowsAny<T>(Func<ValueTask>, string?, string?)Asserts that the asynchronous action throws an exception assignable to the specified type.
ThrowsAnyAsync(Type, Func<Task<object?>>, string?, string?)Compatibility shim for xUnit. Asserts that the asynchronous function throws an exception assignable to the specified type.
ThrowsAnyAsync(Type, Func<Task>, string?, string?)Compatibility shim for xUnit. Asserts that the asynchronous action throws an exception assignable to the specified type.
ThrowsAnyAsync<T>(Func<Task<object?>>, string?, string?)Compatibility shim for xUnit. Asserts that the asynchronous function throws an exception assignable to the specified type.
ThrowsAnyAsync<T>(Func<Task>, string?, string?)Compatibility shim for xUnit. Asserts that the asynchronous action throws an exception assignable to the specified type.
ThrowsAsync(Type, Func<Task<object?>>, string?, string?)Compatibility shim for xUnit. Asserts that the asynchronous function throws an exception exactly of the specified type.
ThrowsAsync(Type, Func<Task>, string?, string?)Compatibility shim for xUnit. Asserts that the asynchronous action throws an exception exactly of the specified type.
ThrowsAsync<T>(Func<Task<object?>>, string?, string?)Compatibility shim for xUnit. Asserts that the asynchronous function throws an exception exactly of the specified type.
ThrowsAsync<T>(Func<Task>, string?, string?)Compatibility shim for xUnit. Asserts that the asynchronous action throws an exception exactly of the specified type.
ThrowsAsync<T>(string?, Func<Task>, string?, string?)Compatibility shim for xUnit. Asserts that the asynchronous action throws an exception exactly of the specified type, whose ArgumentException.ParamName is paramName.
True(bool, string?, string?)Asserts that a condition is true. If the condition is false, an AssertionException is thrown.
True(bool?, string?, string?)Asserts that a nullable condition is true. If the condition is false or null, an AssertionException is thrown.
UseFormatterOptions(FormatterOptions)Uses the specified options to format assertion failure messages in the current asynchronous flow, until the returned scope is disposed.
XunitSkip(string)Skips the currently running xunit test by throwing an AssertionException whose message uses the format expected by xunit for dynamically skipped tests.

All overloads

All(IEnumerable?, Action<object?, int>, string?, string?, string?)

Assert.All.cs

Asserts that all items in a non-generic enumerable satisfy the specified assertion.

public static void All(IEnumerable? actual, Action<object?, int> assertion, string? message = null, string? actualExpression = null, string? assertionExpression = null)
Parameters
actual IEnumerable?
The enumerable to inspect.
assertion Action<object?, int>
The assertion to run for each item and index.
message string?
actualExpression string?
The expression that produced the actual value.
assertionExpression string?
The expression that produced the assertion.

All(IEnumerable?, Action<object?>, string?, string?, string?)

Assert.All.cs

Asserts that all items in a non-generic enumerable satisfy the specified assertion.

public static void All(IEnumerable? actual, Action<object?> assertion, string? message = null, string? actualExpression = null, string? assertionExpression = null)
Parameters
actual IEnumerable?
The enumerable to inspect.
assertion Action<object?>
The assertion to run for each item.
message string?
actualExpression string?
The expression that produced the actual value.
assertionExpression string?
The expression that produced the assertion.

All<T>(IAsyncEnumerable<T>?, Action<T, int>, string?, string?, string?)

Assert.All.cs

Asserts that all items in an asynchronous sequence satisfy the specified assertion.

net10.0

public static Task All<T>(IAsyncEnumerable<T>? actual, Action<T, int> assertion, string? message = null, string? actualExpression = null, string? assertionExpression = null)

net11.0

public static Task All<T>(IAsyncEnumerable<T>? actual, Action<T, int> assertion, string? message = null, string? actualExpression = null, string? assertionExpression = null)
Type parameters
T
Parameters
actual IAsyncEnumerable<T>?
The sequence to inspect.
assertion Action<T, int>
The assertion to run for each item and index.
message string?
actualExpression string?
The expression that produced the actual value.
assertionExpression string?
The expression that produced the assertion.
Returns

Task

All<T>(IAsyncEnumerable<T>?, Action<T>, string?, string?, string?)

Assert.All.cs

Asserts that all items in an asynchronous sequence satisfy the specified assertion.

net10.0

public static Task All<T>(IAsyncEnumerable<T>? actual, Action<T> assertion, string? message = null, string? actualExpression = null, string? assertionExpression = null)

net11.0

public static Task All<T>(IAsyncEnumerable<T>? actual, Action<T> assertion, string? message = null, string? actualExpression = null, string? assertionExpression = null)
Type parameters
T
Parameters
actual IAsyncEnumerable<T>?
The sequence to inspect.
assertion Action<T>
The assertion to run for each item.
message string?
actualExpression string?
The expression that produced the actual value.
assertionExpression string?
The expression that produced the assertion.
Returns

Task

All<T>(IAsyncEnumerable<T>?, Func<T, int, Task>, string?, string?, string?)

Assert.All.cs

Asserts that all items in an asynchronous sequence satisfy the specified asynchronous assertion.

net10.0

public static Task All<T>(IAsyncEnumerable<T>? actual, Func<T, int, Task> assertion, string? message = null, string? actualExpression = null, string? assertionExpression = null)

net11.0

public static Task All<T>(IAsyncEnumerable<T>? actual, Func<T, int, Task> assertion, string? message = null, string? actualExpression = null, string? assertionExpression = null)
Type parameters
T
Parameters
actual IAsyncEnumerable<T>?
The sequence to inspect.
assertion Func<T, int, Task>
The assertion to run for each item and index.
message string?
actualExpression string?
The expression that produced the actual value.
assertionExpression string?
The expression that produced the assertion.
Returns

Task

All<T>(IAsyncEnumerable<T>?, Func<T, Task>, string?, string?, string?)

Assert.All.cs

Asserts that all items in an asynchronous sequence satisfy the specified asynchronous assertion.

net10.0

public static Task All<T>(IAsyncEnumerable<T>? actual, Func<T, Task> assertion, string? message = null, string? actualExpression = null, string? assertionExpression = null)

net11.0

public static Task All<T>(IAsyncEnumerable<T>? actual, Func<T, Task> assertion, string? message = null, string? actualExpression = null, string? assertionExpression = null)
Type parameters
T
Parameters
actual IAsyncEnumerable<T>?
The sequence to inspect.
assertion Func<T, Task>
The assertion to run for each item.
message string?
actualExpression string?
The expression that produced the actual value.
assertionExpression string?
The expression that produced the assertion.
Returns

Task

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

Assert.All.cs

Asserts that all items in an enumerable satisfy the specified assertion.

public static void All<T>(IEnumerable<T>? actual, Action<T, int> assertion, string? message = null, string? actualExpression = null, string? assertionExpression = null)
Type parameters
T
Parameters
actual IEnumerable<T>?
The enumerable to inspect.
assertion Action<T, int>
The assertion to run for each item and index.
message string?
actualExpression string?
The expression that produced the actual value.
assertionExpression string?
The expression that produced the assertion.

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

Assert.All.cs

Asserts that all items in an enumerable satisfy the specified assertion.

public static void All<T>(IEnumerable<T>? actual, Action<T> assertion, string? message = null, string? actualExpression = null, string? assertionExpression = null)
Type parameters
T
Parameters
actual IEnumerable<T>?
The enumerable to inspect.
assertion Action<T>
The assertion to run for each item.
message string?
actualExpression string?
The expression that produced the actual value.
assertionExpression string?
The expression that produced the assertion.

All<T>(IEnumerable<T>?, Func<T, bool>, string?, string?, string?)

Assert.All.cs

Asserts that all items in an enumerable satisfy the specified predicate.

public static void All<T>(IEnumerable<T>? actual, Func<T, bool> predicate, string? message = null, string? actualExpression = null, string? predicateExpression = null)
Type parameters
T
Parameters
actual IEnumerable<T>?
The enumerable to inspect.
predicate Func<T, bool>
The predicate that every item must satisfy.
message string?
actualExpression string?
The expression that produced the actual value.
predicateExpression string?
The expression that produced the predicate.

All<T>(ReadOnlySpan<T>, Action<T, int>, string?, string?, string?)

Assert.All.cs

Asserts that all items in a span satisfy the specified assertion.

public static void All<T>(ReadOnlySpan<T> actual, Action<T, int> assertion, string? message = null, string? actualExpression = null, string? assertionExpression = null)
Type parameters
T
Parameters
actual ReadOnlySpan<T>
The span to inspect.
assertion Action<T, int>
The assertion to run for each item and index.
message string?
actualExpression string?
The expression that produced the actual value.
assertionExpression string?
The expression that produced the assertion.

All<T>(ReadOnlySpan<T>, Action<T>, string?, string?, string?)

Assert.All.cs

Asserts that all items in a span satisfy the specified assertion.

public static void All<T>(ReadOnlySpan<T> actual, Action<T> assertion, string? message = null, string? actualExpression = null, string? assertionExpression = null)
Type parameters
T
Parameters
actual ReadOnlySpan<T>
The span to inspect.
assertion Action<T>
The assertion to run for each item.
message string?
actualExpression string?
The expression that produced the actual value.
assertionExpression string?
The expression that produced the assertion.

All<T>(T[]?, Action<T, int>, string?, string?, string?)

Assert.All.cs

Asserts that an array is not null and all its items satisfy the specified assertion.

public static void All<T>(T[]? actual, Action<T, int> assertion, string? message = null, string? actualExpression = null, string? assertionExpression = null)
Type parameters
T
Parameters
actual T[]?
The array to inspect.
assertion Action<T, int>
The assertion to run for each item and index.
message string?
actualExpression string?
The expression that produced the actual value.
assertionExpression string?
The expression that produced the assertion.
Remarks

Arrays would otherwise bind to the ReadOnlySpan<T> overload, which turns a null array into an empty span.

All<T>(T[]?, Action<T>, string?, string?, string?)

Assert.All.cs

Asserts that an array is not null and all its items satisfy the specified assertion.

public static void All<T>(T[]? actual, Action<T> assertion, string? message = null, string? actualExpression = null, string? assertionExpression = null)
Type parameters
T
Parameters
actual T[]?
The array to inspect.
assertion Action<T>
The assertion to run for each item.
message string?
actualExpression string?
The expression that produced the actual value.
assertionExpression string?
The expression that produced the assertion.
Remarks

Arrays would otherwise bind to the ReadOnlySpan<T> overload, which turns a null array into an empty span.

All<T>(T[]?, Func<T, bool>, string?, string?, string?)

Assert.All.cs

Asserts that an array is not null and all its items satisfy the specified predicate.

public static void All<T>(T[]? actual, Func<T, bool> predicate, string? message = null, string? actualExpression = null, string? predicateExpression = null)
Type parameters
T
Parameters
actual T[]?
The array to inspect.
predicate Func<T, bool>
The predicate that every item must satisfy.
message string?
actualExpression string?
The expression that produced the actual value.
predicateExpression string?
The expression that produced the predicate.
Remarks

Without this overload, the priority of the Action<T> array overload would bind a lambda that returns a value, such as x => set.Add(x), to the assertion overload and ignore its result.

Collection overloads

Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, string?, string?)

Assert.Collection.cs
public static void Collection<T>(IEnumerable<T>? actual, Action<T> inspector1, Action<T> inspector2, Action<T> inspector3, Action<T> inspector4, Action<T> inspector5, Action<T> inspector6, Action<T> inspector7, Action<T> inspector8, Action<T> inspector9, Action<T> inspector10, Action<T> inspector11, Action<T> inspector12, Action<T> inspector13, Action<T> inspector14, Action<T> inspector15, Action<T> inspector16, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual IEnumerable<T>?
inspector1 Action<T>
inspector2 Action<T>
inspector3 Action<T>
inspector4 Action<T>
inspector5 Action<T>
inspector6 Action<T>
inspector7 Action<T>
inspector8 Action<T>
inspector9 Action<T>
inspector10 Action<T>
inspector11 Action<T>
inspector12 Action<T>
inspector13 Action<T>
inspector14 Action<T>
inspector15 Action<T>
inspector16 Action<T>
message string?
actualExpression string?

No documentation is available.

Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, string?, string?)

Assert.Collection.cs
public static void Collection<T>(IEnumerable<T>? actual, Action<T> inspector1, Action<T> inspector2, Action<T> inspector3, Action<T> inspector4, Action<T> inspector5, Action<T> inspector6, Action<T> inspector7, Action<T> inspector8, Action<T> inspector9, Action<T> inspector10, Action<T> inspector11, Action<T> inspector12, Action<T> inspector13, Action<T> inspector14, Action<T> inspector15, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual IEnumerable<T>?
inspector1 Action<T>
inspector2 Action<T>
inspector3 Action<T>
inspector4 Action<T>
inspector5 Action<T>
inspector6 Action<T>
inspector7 Action<T>
inspector8 Action<T>
inspector9 Action<T>
inspector10 Action<T>
inspector11 Action<T>
inspector12 Action<T>
inspector13 Action<T>
inspector14 Action<T>
inspector15 Action<T>
message string?
actualExpression string?

No documentation is available.

Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, string?, string?)

Assert.Collection.cs
public static void Collection<T>(IEnumerable<T>? actual, Action<T> inspector1, Action<T> inspector2, Action<T> inspector3, Action<T> inspector4, Action<T> inspector5, Action<T> inspector6, Action<T> inspector7, Action<T> inspector8, Action<T> inspector9, Action<T> inspector10, Action<T> inspector11, Action<T> inspector12, Action<T> inspector13, Action<T> inspector14, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual IEnumerable<T>?
inspector1 Action<T>
inspector2 Action<T>
inspector3 Action<T>
inspector4 Action<T>
inspector5 Action<T>
inspector6 Action<T>
inspector7 Action<T>
inspector8 Action<T>
inspector9 Action<T>
inspector10 Action<T>
inspector11 Action<T>
inspector12 Action<T>
inspector13 Action<T>
inspector14 Action<T>
message string?
actualExpression string?

No documentation is available.

Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, string?, string?)

Assert.Collection.cs
public static void Collection<T>(IEnumerable<T>? actual, Action<T> inspector1, Action<T> inspector2, Action<T> inspector3, Action<T> inspector4, Action<T> inspector5, Action<T> inspector6, Action<T> inspector7, Action<T> inspector8, Action<T> inspector9, Action<T> inspector10, Action<T> inspector11, Action<T> inspector12, Action<T> inspector13, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual IEnumerable<T>?
inspector1 Action<T>
inspector2 Action<T>
inspector3 Action<T>
inspector4 Action<T>
inspector5 Action<T>
inspector6 Action<T>
inspector7 Action<T>
inspector8 Action<T>
inspector9 Action<T>
inspector10 Action<T>
inspector11 Action<T>
inspector12 Action<T>
inspector13 Action<T>
message string?
actualExpression string?

No documentation is available.

Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, string?, string?)

Assert.Collection.cs
public static void Collection<T>(IEnumerable<T>? actual, Action<T> inspector1, Action<T> inspector2, Action<T> inspector3, Action<T> inspector4, Action<T> inspector5, Action<T> inspector6, Action<T> inspector7, Action<T> inspector8, Action<T> inspector9, Action<T> inspector10, Action<T> inspector11, Action<T> inspector12, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual IEnumerable<T>?
inspector1 Action<T>
inspector2 Action<T>
inspector3 Action<T>
inspector4 Action<T>
inspector5 Action<T>
inspector6 Action<T>
inspector7 Action<T>
inspector8 Action<T>
inspector9 Action<T>
inspector10 Action<T>
inspector11 Action<T>
inspector12 Action<T>
message string?
actualExpression string?

No documentation is available.

Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, string?, string?)

Assert.Collection.cs
public static void Collection<T>(IEnumerable<T>? actual, Action<T> inspector1, Action<T> inspector2, Action<T> inspector3, Action<T> inspector4, Action<T> inspector5, Action<T> inspector6, Action<T> inspector7, Action<T> inspector8, Action<T> inspector9, Action<T> inspector10, Action<T> inspector11, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual IEnumerable<T>?
inspector1 Action<T>
inspector2 Action<T>
inspector3 Action<T>
inspector4 Action<T>
inspector5 Action<T>
inspector6 Action<T>
inspector7 Action<T>
inspector8 Action<T>
inspector9 Action<T>
inspector10 Action<T>
inspector11 Action<T>
message string?
actualExpression string?

No documentation is available.

Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, string?, string?)

Assert.Collection.cs
public static void Collection<T>(IEnumerable<T>? actual, Action<T> inspector1, Action<T> inspector2, Action<T> inspector3, Action<T> inspector4, Action<T> inspector5, Action<T> inspector6, Action<T> inspector7, Action<T> inspector8, Action<T> inspector9, Action<T> inspector10, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual IEnumerable<T>?
inspector1 Action<T>
inspector2 Action<T>
inspector3 Action<T>
inspector4 Action<T>
inspector5 Action<T>
inspector6 Action<T>
inspector7 Action<T>
inspector8 Action<T>
inspector9 Action<T>
inspector10 Action<T>
message string?
actualExpression string?

No documentation is available.

Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, string?, string?)

Assert.Collection.cs
public static void Collection<T>(IEnumerable<T>? actual, Action<T> inspector1, Action<T> inspector2, Action<T> inspector3, Action<T> inspector4, Action<T> inspector5, Action<T> inspector6, Action<T> inspector7, Action<T> inspector8, Action<T> inspector9, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual IEnumerable<T>?
inspector1 Action<T>
inspector2 Action<T>
inspector3 Action<T>
inspector4 Action<T>
inspector5 Action<T>
inspector6 Action<T>
inspector7 Action<T>
inspector8 Action<T>
inspector9 Action<T>
message string?
actualExpression string?

No documentation is available.

Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, string?, string?)

Assert.Collection.cs
public static void Collection<T>(IEnumerable<T>? actual, Action<T> inspector1, Action<T> inspector2, Action<T> inspector3, Action<T> inspector4, Action<T> inspector5, Action<T> inspector6, Action<T> inspector7, Action<T> inspector8, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual IEnumerable<T>?
inspector1 Action<T>
inspector2 Action<T>
inspector3 Action<T>
inspector4 Action<T>
inspector5 Action<T>
inspector6 Action<T>
inspector7 Action<T>
inspector8 Action<T>
message string?
actualExpression string?

No documentation is available.

Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, string?, string?)

Assert.Collection.cs
public static void Collection<T>(IEnumerable<T>? actual, Action<T> inspector1, Action<T> inspector2, Action<T> inspector3, Action<T> inspector4, Action<T> inspector5, Action<T> inspector6, Action<T> inspector7, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual IEnumerable<T>?
inspector1 Action<T>
inspector2 Action<T>
inspector3 Action<T>
inspector4 Action<T>
inspector5 Action<T>
inspector6 Action<T>
inspector7 Action<T>
message string?
actualExpression string?

No documentation is available.

Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, string?, string?)

Assert.Collection.cs
public static void Collection<T>(IEnumerable<T>? actual, Action<T> inspector1, Action<T> inspector2, Action<T> inspector3, Action<T> inspector4, Action<T> inspector5, Action<T> inspector6, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual IEnumerable<T>?
inspector1 Action<T>
inspector2 Action<T>
inspector3 Action<T>
inspector4 Action<T>
inspector5 Action<T>
inspector6 Action<T>
message string?
actualExpression string?

No documentation is available.

Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, string?, string?)

Assert.Collection.cs
public static void Collection<T>(IEnumerable<T>? actual, Action<T> inspector1, Action<T> inspector2, Action<T> inspector3, Action<T> inspector4, Action<T> inspector5, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual IEnumerable<T>?
inspector1 Action<T>
inspector2 Action<T>
inspector3 Action<T>
inspector4 Action<T>
inspector5 Action<T>
message string?
actualExpression string?

No documentation is available.

Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, Action<T>, string?, string?)

Assert.Collection.cs
public static void Collection<T>(IEnumerable<T>? actual, Action<T> inspector1, Action<T> inspector2, Action<T> inspector3, Action<T> inspector4, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual IEnumerable<T>?
inspector1 Action<T>
inspector2 Action<T>
inspector3 Action<T>
inspector4 Action<T>
message string?
actualExpression string?

No documentation is available.

Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, string?, string?)

Assert.Collection.cs
public static void Collection<T>(IEnumerable<T>? actual, Action<T> inspector1, Action<T> inspector2, Action<T> inspector3, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual IEnumerable<T>?
inspector1 Action<T>
inspector2 Action<T>
inspector3 Action<T>
message string?
actualExpression string?

No documentation is available.

Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, string?, string?)

Assert.Collection.cs
public static void Collection<T>(IEnumerable<T>? actual, Action<T> inspector1, Action<T> inspector2, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual IEnumerable<T>?
inspector1 Action<T>
inspector2 Action<T>
message string?
actualExpression string?

No documentation is available.

Collection<T>(IEnumerable<T>?, Action<T>, string?, string?)

Assert.Collection.cs
public static void Collection<T>(IEnumerable<T>? actual, Action<T> inspector1, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual IEnumerable<T>?
inspector1 Action<T>
message string?
actualExpression string?

No documentation is available.

Collection<T>(IEnumerable<T>?, Action<T>[], string?, string?)

Assert.Collection.cs
public static void Collection<T>(IEnumerable<T>? actual, Action<T>[] inspectors, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual IEnumerable<T>?
inspectors Action<T>[]
message string?
actualExpression string?

No documentation is available.

Collection<T>(IEnumerable<T>?, string?, string?)

Assert.Collection.cs
public static void Collection<T>(IEnumerable<T>? actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual IEnumerable<T>?
message string?
actualExpression string?

No documentation is available.

Contains overloads

Contains(char, string?, IEqualityComparer<char>?, string?, string?, string?)

Assert.Contains.cs

Asserts that a string contains the specified character.

public static void Contains(char expected, string? actual, IEqualityComparer<char>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected char
The character expected in actual.
actual string?
The string to inspect.
comparer IEqualityComparer<char>?
The comparer used to compare characters.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

Contains(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)

Assert.Contains.cs

Asserts that a non-generic enumerable contains the specified contiguous non-generic subsequence.

public static void Contains(IEnumerable expected, IEnumerable? actual, IEqualityComparer? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected IEnumerable
The subsequence expected in actual. Without comparer, the assertion also succeeds when expected is itself an item of actual. A string is searched as an item, unless actual is a sequence of characters.
actual IEnumerable?
The enumerable to inspect. It is read only until the subsequence is found.
comparer IEqualityComparer?
The comparer used to compare values.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

Contains(object?, IDictionary?, string?, string?, string?)

Assert.Contains.cs

Asserts that a non-generic dictionary contains the specified key and returns the associated value.

public static object? Contains(object? expected, IDictionary? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected object?
The key expected in actual.
actual IDictionary?
The dictionary to inspect.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected key.
Returns

object?

Contains(object?, IEnumerable?, string?, string?, string?)

Assert.Contains.cs

Asserts that a non-generic enumerable contains the specified value.

public static void Contains(object? expected, IEnumerable? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected object?
The value expected in actual. A string searched in a sequence of characters is searched as a substring.
actual IEnumerable?
The enumerable to inspect.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

Contains(ReadOnlySpan<char>, ReadOnlySpan<char>, bool, string?, string?, string?)

Assert.Contains.cs

Asserts that a character span contains the specified substring.

public static void Contains(ReadOnlySpan<char> expected, ReadOnlySpan<char> actual, bool ignoreCase = false, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected ReadOnlySpan<char>
The substring expected in actual.
actual ReadOnlySpan<char>
The span to inspect.
ignoreCase bool
When true, the comparison ignores casing (OrdinalIgnoreCase); otherwise, it is case-sensitive (Ordinal).
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

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

Assert.Contains.cs

Asserts that a character span contains the specified substring.

public static void Contains(ReadOnlySpan<char> expected, ReadOnlySpan<char> actual, StringComparison comparisonType, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected ReadOnlySpan<char>
The substring expected in actual.
actual ReadOnlySpan<char>
The span to inspect.
comparisonType StringComparison
The comparison used to search for expected.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

Contains(string, IDictionary?, string?, string?, string?)

Assert.Contains.cs

Asserts that a non-generic dictionary contains the specified string key and returns the associated value.

public static object? Contains(string expected, IDictionary? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected string
The key expected in actual.
actual IDictionary?
The dictionary to inspect.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected key.
Returns

object?

Contains(string, string?, bool, string?, string?, string?)

Assert.Contains.cs

Asserts that a string contains the specified substring.

public static void Contains(string expected, string? actual, bool ignoreCase = false, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected string
The substring expected in actual.
actual string?
The string to inspect.
ignoreCase bool
When true, the comparison ignores casing (OrdinalIgnoreCase); otherwise, it is case-sensitive (Ordinal).
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

Contains(string, string?, StringComparison, string?, string?, string?)

Assert.Contains.cs

Asserts that a string contains the specified substring.

public static void Contains(string expected, string? actual, StringComparison comparisonType, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected string
The substring expected in actual.
actual string?
The string to inspect.
comparisonType StringComparison
The comparison used to search for expected.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

Contains<T>(IEnumerable<T>, IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)

Assert.Contains.cs

Asserts that an asynchronous sequence contains the specified contiguous subsequence.

net10.0

public static Task Contains<T>(IEnumerable<T> expected, IAsyncEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)

net11.0

public static Task Contains<T>(IEnumerable<T> expected, IAsyncEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected IEnumerable<T>
The subsequence expected in actual. When expected is itself an item of actual, the assertion also succeeds.
actual IAsyncEnumerable<T>?
The sequence to inspect. It is read only until the subsequence is found.
comparer IEqualityComparer<T>?
The comparer used to compare values.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.
Returns

Task

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

Assert.Contains.cs

Asserts that an enumerable contains the specified contiguous subsequence.

public static void Contains<T>(IEnumerable<T> expected, IEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected IEnumerable<T>
The subsequence expected in actual. When expected is itself an item of actual, the assertion also succeeds.
actual IEnumerable<T>?
The enumerable to inspect. It is read only until the subsequence is found.
comparer IEqualityComparer<T>?
The comparer used to compare values.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

Contains<T>(IEnumerable<T>?, Func<T, bool>, string?, string?, string?)

Assert.Contains.cs

Asserts that an enumerable contains at least one item that matches the specified predicate.

public static void Contains<T>(IEnumerable<T>? actual, Func<T, bool> predicate, string? message = null, string? actualExpression = null, string? predicateExpression = null)
Type parameters
T
Parameters
actual IEnumerable<T>?
The enumerable to inspect.
predicate Func<T, bool>
The predicate used to select matching items.
message string?
actualExpression string?
The expression that produced the actual value.
predicateExpression string?
The expression that produced the predicate.

Contains<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)

Assert.Contains.cs

Asserts that a span contains the specified subsequence.

public static void Contains<T>(ReadOnlySpan<T> expected, ReadOnlySpan<T> actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected ReadOnlySpan<T>
The subsequence expected in actual.
actual ReadOnlySpan<T>
The span to inspect.
comparer IEqualityComparer<T>?
The comparer used to compare values.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

Contains<T>(T, ICollection<T>?, string?, string?, string?)

Assert.Contains.cs

Asserts that an enumerable contains the specified value.

public static void Contains<T>(T expected, ICollection<T>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected T
The value expected in actual.
actual ICollection<T>?
The collection to inspect.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

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

Assert.Contains.cs

Asserts that an enumerable contains the specified value.

public static void Contains<T>(T expected, IEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected T
The value expected in actual.
actual IEnumerable<T>?
The enumerable to inspect.
comparer IEqualityComparer<T>?
The comparer used to compare values. When null and actual is an ICollection<T>, the collection decides (like Enumerable.Contains), so a set uses its own comparer.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

Contains<T>(T, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)

Assert.Contains.cs

Asserts that a span contains the specified value.

public static void Contains<T>(T expected, ReadOnlySpan<T> actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected T
The value expected in actual.
actual ReadOnlySpan<T>
The span to inspect.
comparer IEqualityComparer<T>?
The comparer used to compare values.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

Contains<T>(T, T[]?, IEqualityComparer<T>?, string?, string?, string?)

Assert.Contains.cs

Asserts that an array contains the specified value.

public static void Contains<T>(T expected, T[]? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected T
The value expected in actual.
actual T[]?
The array to inspect.
comparer IEqualityComparer<T>?
The comparer used to compare values.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

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

Assert.Contains.cs

Asserts that a dictionary contains the specified key and returns the associated value.

public static TValue Contains<TKey, TValue>(TKey expected, Dictionary<TKey, TValue>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null) where TKey : notnull
Type parameters
TKey
TValue
Parameters
expected TKey
The key expected in actual.
actual Dictionary<TKey, TValue>?
The dictionary to inspect.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected key.
Returns

TValue

Contains<TKey, TValue>(TKey, IEnumerable<KeyValuePair<TKey, TValue>>?, IEqualityComparer<TKey>?, string?, string?, string?)

Assert.Contains.cs

Asserts that a dictionary-like collection contains the specified key and returns the associated value.

public static TValue Contains<TKey, TValue>(TKey expected, IEnumerable<KeyValuePair<TKey, TValue>>? actual, IEqualityComparer<TKey>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
TKey
TValue
Parameters
expected TKey
The key expected in actual.
actual IEnumerable<KeyValuePair<TKey, TValue>>?
The dictionary-like collection to inspect.
comparer IEqualityComparer<TKey>?
The comparer used to compare keys. When null and actual is a dictionary, only the dictionary's own lookup decides.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected key.
Returns

TValue

Distinct overloads

Distinct(IEnumerable?, IEqualityComparer?, string?, string?)

Assert.Distinct.cs

Asserts that a non-generic enumerable does not contain duplicate items.

public static void Distinct(IEnumerable? actual, IEqualityComparer? comparer = null, string? message = null, string? actualExpression = null)
Parameters
actual IEnumerable?
The enumerable to inspect.
comparer IEqualityComparer?
The comparer used to compare values.
message string?
actualExpression string?
The expression that produced the actual value.

Distinct(string?, string?, string?)

Assert.Distinct.cs

Asserts that a string does not contain duplicate characters.

public static void Distinct(string? actual, string? message = null, string? actualExpression = null)
Parameters
actual string?
The string to inspect.
message string?
actualExpression string?
The expression that produced the actual value.

Distinct<T>(IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?)

Assert.Distinct.cs

Asserts that an asynchronous sequence does not contain duplicate items.

net10.0

public static Task Distinct<T>(IAsyncEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null)

net11.0

public static Task Distinct<T>(IAsyncEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual IAsyncEnumerable<T>?
The sequence to inspect.
comparer IEqualityComparer<T>?
The comparer used to compare values.
message string?
actualExpression string?
The expression that produced the actual value.
Returns

Task

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

Assert.Distinct.cs

Asserts that an enumerable does not contain duplicate items.

public static void Distinct<T>(IEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual IEnumerable<T>?
The enumerable to inspect.
comparer IEqualityComparer<T>?
The comparer used to compare values.
message string?
actualExpression string?
The expression that produced the actual value.

Distinct<T>(ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?)

Assert.Distinct.cs

Asserts that a span does not contain duplicate items.

public static void Distinct<T>(ReadOnlySpan<T> actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual ReadOnlySpan<T>
The span to inspect.
comparer IEqualityComparer<T>?
The comparer used to compare values.
message string?
actualExpression string?
The expression that produced the actual value.

Distinct<T>(T[]?, IEqualityComparer<T>?, string?, string?)

Assert.Distinct.cs

Asserts that an array is not null and does not contain duplicate items.

public static void Distinct<T>(T[]? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual T[]?
The array to inspect.
comparer IEqualityComparer<T>?
The comparer used to compare values.
message string?
actualExpression string?
The expression that produced the actual value.
Remarks

Arrays would otherwise bind to the ReadOnlySpan<T> overload, which turns a null array into an empty span.

DoesNotAll<T>(IEnumerable<T>?, Func<T, bool>, string?, string?, string?)

Assert.DoesNotAll.cs

Asserts that not all items in an enumerable satisfy the specified predicate (i.e., at least one item does not).

public static void DoesNotAll<T>(IEnumerable<T>? actual, Func<T, bool> predicate, string? message = null, string? actualExpression = null, string? predicateExpression = null)

Type parameters

T

Parameters

actual IEnumerable<T>?
The enumerable to inspect.
predicate Func<T, bool>
The predicate that at least one item must not satisfy.
message string?
actualExpression string?
The expression that produced the actual value.
predicateExpression string?
The expression that produced the predicate.

DoesNotContain overloads

DoesNotContain(char, string?, IEqualityComparer<char>?, string?, string?, string?)

Assert.DoesNotContain.cs
public static void DoesNotContain(char expected, string? actual, IEqualityComparer<char>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected char
actual string?
comparer IEqualityComparer<char>?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotContain(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)

Assert.DoesNotContain.cs
public static void DoesNotContain(IEnumerable expected, IEnumerable? actual, IEqualityComparer? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected IEnumerable
actual IEnumerable?
comparer IEqualityComparer?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotContain(object?, IDictionary?, string?, string?, string?)

Assert.DoesNotContain.cs
public static void DoesNotContain(object? expected, IDictionary? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected object?
actual IDictionary?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotContain(object?, IEnumerable?, string?, string?, string?)

Assert.DoesNotContain.cs
public static void DoesNotContain(object? expected, IEnumerable? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected object?
actual IEnumerable?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotContain(ReadOnlySpan<char>, ReadOnlySpan<char>, bool, string?, string?, string?)

Assert.DoesNotContain.cs
public static void DoesNotContain(ReadOnlySpan<char> expected, ReadOnlySpan<char> actual, bool ignoreCase = false, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected ReadOnlySpan<char>
actual ReadOnlySpan<char>
ignoreCase bool
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

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

Assert.DoesNotContain.cs
public static void DoesNotContain(ReadOnlySpan<char> expected, ReadOnlySpan<char> actual, StringComparison comparisonType, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected ReadOnlySpan<char>
actual ReadOnlySpan<char>
comparisonType StringComparison
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotContain(string, IDictionary?, string?, string?, string?)

Assert.DoesNotContain.cs
public static void DoesNotContain(string expected, IDictionary? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected string
actual IDictionary?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotContain(string, string?, bool, string?, string?, string?)

Assert.DoesNotContain.cs
public static void DoesNotContain(string expected, string? actual, bool ignoreCase = false, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected string
actual string?
ignoreCase bool
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotContain(string, string?, StringComparison, string?, string?, string?)

Assert.DoesNotContain.cs
public static void DoesNotContain(string expected, string? actual, StringComparison comparisonType, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected string
actual string?
comparisonType StringComparison
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotContain<T>(IEnumerable<T>, IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)

Assert.DoesNotContain.cs

net10.0

public static Task DoesNotContain<T>(IEnumerable<T> expected, IAsyncEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)

net11.0

public static Task DoesNotContain<T>(IEnumerable<T> expected, IAsyncEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected IEnumerable<T>
actual IAsyncEnumerable<T>?
comparer IEqualityComparer<T>?
message string?
actualExpression string?
expectedExpression string?
Returns

Task

No documentation is available.

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

Assert.DoesNotContain.cs
public static void DoesNotContain<T>(IEnumerable<T> expected, IEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected IEnumerable<T>
actual IEnumerable<T>?
comparer IEqualityComparer<T>?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotContain<T>(IEnumerable<T>?, Func<T, bool>, string?, string?, string?)

Assert.DoesNotContain.cs
public static void DoesNotContain<T>(IEnumerable<T>? actual, Func<T, bool> predicate, string? message = null, string? actualExpression = null, string? predicateExpression = null)
Type parameters
T
Parameters
actual IEnumerable<T>?
predicate Func<T, bool>
message string?
actualExpression string?
predicateExpression string?

No documentation is available.

DoesNotContain<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)

Assert.DoesNotContain.cs
public static void DoesNotContain<T>(ReadOnlySpan<T> expected, ReadOnlySpan<T> actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected ReadOnlySpan<T>
actual ReadOnlySpan<T>
comparer IEqualityComparer<T>?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotContain<T>(T, ICollection<T>?, string?, string?, string?)

Assert.DoesNotContain.cs
public static void DoesNotContain<T>(T expected, ICollection<T>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected T
actual ICollection<T>?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

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

Assert.DoesNotContain.cs
public static void DoesNotContain<T>(T expected, IEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected T
actual IEnumerable<T>?
comparer IEqualityComparer<T>?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotContain<T>(T, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)

Assert.DoesNotContain.cs
public static void DoesNotContain<T>(T expected, ReadOnlySpan<T> actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected T
actual ReadOnlySpan<T>
comparer IEqualityComparer<T>?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotContain<T>(T, T[]?, IEqualityComparer<T>?, string?, string?, string?)

Assert.DoesNotContain.cs
public static void DoesNotContain<T>(T expected, T[]? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected T
actual T[]?
comparer IEqualityComparer<T>?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

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

Assert.DoesNotContain.cs
public static void DoesNotContain<TKey, TValue>(TKey expected, Dictionary<TKey, TValue>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null) where TKey : notnull
Type parameters
TKey
TValue
Parameters
expected TKey
actual Dictionary<TKey, TValue>?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotContain<TKey, TValue>(TKey, IEnumerable<KeyValuePair<TKey, TValue>>?, IEqualityComparer<TKey>?, string?, string?, string?)

Assert.DoesNotContain.cs
public static void DoesNotContain<TKey, TValue>(TKey expected, IEnumerable<KeyValuePair<TKey, TValue>>? actual, IEqualityComparer<TKey>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
TKey
TValue
Parameters
expected TKey
actual IEnumerable<KeyValuePair<TKey, TValue>>?
comparer IEqualityComparer<TKey>?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotEndWith overloads

DoesNotEndWith(char, string?, IEqualityComparer<char>?, string?, string?, string?)

Assert.DoesNotEndWith.cs
public static void DoesNotEndWith(char expected, string? actual, IEqualityComparer<char>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected char
actual string?
comparer IEqualityComparer<char>?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotEndWith(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)

Assert.DoesNotEndWith.cs
public static void DoesNotEndWith(IEnumerable expected, IEnumerable? actual, IEqualityComparer? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected IEnumerable
actual IEnumerable?
comparer IEqualityComparer?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotEndWith(object?, IEnumerable?, string?, string?, string?)

Assert.DoesNotEndWith.cs
public static void DoesNotEndWith(object? expected, IEnumerable? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected object?
actual IEnumerable?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotEndWith(ReadOnlySpan<char>, ReadOnlySpan<char>, bool, string?, string?, string?)

Assert.DoesNotEndWith.cs
public static void DoesNotEndWith(ReadOnlySpan<char> expected, ReadOnlySpan<char> actual, bool ignoreCase = false, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected ReadOnlySpan<char>
actual ReadOnlySpan<char>
ignoreCase bool
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotEndWith(ReadOnlySpan<char>, ReadOnlySpan<char>, StringComparison, string?, string?, string?)

Assert.DoesNotEndWith.cs
public static void DoesNotEndWith(ReadOnlySpan<char> expected, ReadOnlySpan<char> actual, StringComparison comparisonType, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected ReadOnlySpan<char>
actual ReadOnlySpan<char>
comparisonType StringComparison
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotEndWith(string, string?, bool, string?, string?, string?)

Assert.DoesNotEndWith.cs
public static void DoesNotEndWith(string expected, string? actual, bool ignoreCase = false, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected string
actual string?
ignoreCase bool
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotEndWith(string, string?, StringComparison, string?, string?, string?)

Assert.DoesNotEndWith.cs
public static void DoesNotEndWith(string expected, string? actual, StringComparison comparisonType, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected string
actual string?
comparisonType StringComparison
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotEndWith<T>(IEnumerable<T>, IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)

Assert.DoesNotEndWith.cs

net10.0

public static Task DoesNotEndWith<T>(IEnumerable<T> expected, IAsyncEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)

net11.0

public static Task DoesNotEndWith<T>(IEnumerable<T> expected, IAsyncEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected IEnumerable<T>
actual IAsyncEnumerable<T>?
comparer IEqualityComparer<T>?
message string?
actualExpression string?
expectedExpression string?
Returns

Task

No documentation is available.

DoesNotEndWith<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)

Assert.DoesNotEndWith.cs
public static void DoesNotEndWith<T>(IEnumerable<T> expected, IEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected IEnumerable<T>
actual IEnumerable<T>?
comparer IEqualityComparer<T>?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotEndWith<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)

Assert.DoesNotEndWith.cs
public static void DoesNotEndWith<T>(ReadOnlySpan<T> expected, ReadOnlySpan<T> actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected ReadOnlySpan<T>
actual ReadOnlySpan<T>
comparer IEqualityComparer<T>?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotEndWith<T>(T, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)

Assert.DoesNotEndWith.cs
public static void DoesNotEndWith<T>(T expected, IEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected T
actual IEnumerable<T>?
comparer IEqualityComparer<T>?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotEndWith<T>(T, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)

Assert.DoesNotEndWith.cs
public static void DoesNotEndWith<T>(T expected, ReadOnlySpan<T> actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected T
actual ReadOnlySpan<T>
comparer IEqualityComparer<T>?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotEndWith<T>(T, T[]?, IEqualityComparer<T>?, string?, string?, string?)

Assert.DoesNotEndWith.cs
public static void DoesNotEndWith<T>(T expected, T[]? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected T
actual T[]?
comparer IEqualityComparer<T>?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotHaveCount overloads

DoesNotHaveCount(int, IEnumerable?, string?, string?)

Assert.DoesNotHaveCount.cs
public static void DoesNotHaveCount(int expectedCount, IEnumerable? actual, string? message = null, string? actualExpression = null)
Parameters
expectedCount int
actual IEnumerable?
message string?
actualExpression string?

No documentation is available.

DoesNotHaveCount(int, string?, string?, string?)

Assert.DoesNotHaveCount.cs
public static void DoesNotHaveCount(int expectedCount, string? actual, string? message = null, string? actualExpression = null)
Parameters
expectedCount int
actual string?
message string?
actualExpression string?

No documentation is available.

DoesNotHaveCount<T>(int, IAsyncEnumerable<T>?, string?, string?)

Assert.DoesNotHaveCount.cs

net10.0

public static Task DoesNotHaveCount<T>(int expectedCount, IAsyncEnumerable<T>? actual, string? message = null, string? actualExpression = null)

net11.0

public static Task DoesNotHaveCount<T>(int expectedCount, IAsyncEnumerable<T>? actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
expectedCount int
actual IAsyncEnumerable<T>?
message string?
actualExpression string?
Returns

Task

No documentation is available.

DoesNotHaveCount<T>(int, IEnumerable<T>?, string?, string?)

Assert.DoesNotHaveCount.cs
public static void DoesNotHaveCount<T>(int expectedCount, IEnumerable<T>? actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
expectedCount int
actual IEnumerable<T>?
message string?
actualExpression string?

No documentation is available.

DoesNotHaveCount<T>(int, ReadOnlySpan<T>, string?, string?)

Assert.DoesNotHaveCount.cs
public static void DoesNotHaveCount<T>(int expectedCount, ReadOnlySpan<T> actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
expectedCount int
actual ReadOnlySpan<T>
message string?
actualExpression string?

No documentation is available.

DoesNotHaveCount<T>(int, T[]?, string?, string?)

Assert.DoesNotHaveCount.cs
public static void DoesNotHaveCount<T>(int expectedCount, T[]? actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
expectedCount int
actual T[]?
message string?
actualExpression string?

No documentation is available.

DoesNotMatch overloads

DoesNotMatch(string, string, string?, string?, string?)

Assert.DoesNotMatch.cs

Asserts that the specified regular expression pattern does not match the actual value.

public static void DoesNotMatch(string pattern, string actual, string? message = null, string? actualExpression = null, string? patternExpression = null)
Parameters
pattern string
The regular expression pattern not expected to match actual.
actual string
The string to inspect.
message string?
actualExpression string?
The expression that produced the actual value.
patternExpression string?
The expression that produced the pattern.
Remarks

Like Regex.IsMatch, the default match timeout of the application applies (see REGEX_DEFAULT_MATCH_TIMEOUT).

DoesNotMatch(Regex, string, string?, string?, string?)

Assert.DoesNotMatch.cs

Asserts that the specified regular expression does not match the actual value.

public static void DoesNotMatch(Regex regex, string actual, string? message = null, string? actualExpression = null, string? regexExpression = null)
Parameters
regex Regex
The regular expression not expected to match actual.
actual string
The string to inspect.
message string?
actualExpression string?
The expression that produced the actual value.
regexExpression string?
The expression that produced the regular expression.

DoesNotRaise overloads

DoesNotRaise(Action<EventHandler>, Action<EventHandler>, Action, string?, string?)

Assert.DoesNotRaise.cs
public static void DoesNotRaise(Action<EventHandler> attach, Action<EventHandler> detach, Action action, string? message = null, string? actionExpression = null)
Parameters
attach Action<EventHandler>
detach Action<EventHandler>
action Action
message string?
actionExpression string?

No documentation is available.

DoesNotRaise(Action<EventHandler>, Action<EventHandler>, Func<Task>, string?, string?)

Assert.DoesNotRaise.cs

net10.0

public static Task DoesNotRaise(Action<EventHandler> attach, Action<EventHandler> detach, Func<Task> action, string? message = null, string? actionExpression = null)

net11.0

public static Task DoesNotRaise(Action<EventHandler> attach, Action<EventHandler> detach, Func<Task> action, string? message = null, string? actionExpression = null)
Parameters
attach Action<EventHandler>
detach Action<EventHandler>
action Func<Task>
message string?
actionExpression string?
Returns

Task

No documentation is available.

DoesNotRaise(Action<EventHandler>, Action<EventHandler>, Func<ValueTask>, string?, string?)

Assert.DoesNotRaise.cs

net10.0

public static Task DoesNotRaise(Action<EventHandler> attach, Action<EventHandler> detach, Func<ValueTask> action, string? message = null, string? actionExpression = null)

net11.0

public static Task DoesNotRaise(Action<EventHandler> attach, Action<EventHandler> detach, Func<ValueTask> action, string? message = null, string? actionExpression = null)
Parameters
attach Action<EventHandler>
detach Action<EventHandler>
action Func<ValueTask>
message string?
actionExpression string?
Returns

Task

No documentation is available.

DoesNotRaise<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Action, string?, string?)

Assert.DoesNotRaise.cs
public static void DoesNotRaise<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Action action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgs
Type parameters
TEventArgs
Parameters
attach Action<EventHandler<TEventArgs>>
detach Action<EventHandler<TEventArgs>>
action Action
message string?
actionExpression string?

No documentation is available.

DoesNotRaise<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<Task>, string?, string?)

Assert.DoesNotRaise.cs

net10.0

public static Task DoesNotRaise<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Func<Task> action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgs

net11.0

public static Task DoesNotRaise<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Func<Task> action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgs
Type parameters
TEventArgs
Parameters
attach Action<EventHandler<TEventArgs>>
detach Action<EventHandler<TEventArgs>>
action Func<Task>
message string?
actionExpression string?
Returns

Task

No documentation is available.

DoesNotRaise<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<ValueTask>, string?, string?)

Assert.DoesNotRaise.cs

net10.0

public static Task DoesNotRaise<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Func<ValueTask> action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgs

net11.0

public static Task DoesNotRaise<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Func<ValueTask> action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgs
Type parameters
TEventArgs
Parameters
attach Action<EventHandler<TEventArgs>>
detach Action<EventHandler<TEventArgs>>
action Func<ValueTask>
message string?
actionExpression string?
Returns

Task

No documentation is available.

DoesNotRaiseAny overloads

DoesNotRaiseAny(Action<EventHandler>, Action<EventHandler>, Action, string?, string?)

Assert.DoesNotRaise.cs
public static void DoesNotRaiseAny(Action<EventHandler> attach, Action<EventHandler> detach, Action action, string? message = null, string? actionExpression = null)
Parameters
attach Action<EventHandler>
detach Action<EventHandler>
action Action
message string?
actionExpression string?

No documentation is available.

DoesNotRaiseAny(Action<EventHandler>, Action<EventHandler>, Func<Task>, string?, string?)

Assert.DoesNotRaise.cs

net10.0

public static Task DoesNotRaiseAny(Action<EventHandler> attach, Action<EventHandler> detach, Func<Task> action, string? message = null, string? actionExpression = null)

net11.0

public static Task DoesNotRaiseAny(Action<EventHandler> attach, Action<EventHandler> detach, Func<Task> action, string? message = null, string? actionExpression = null)
Parameters
attach Action<EventHandler>
detach Action<EventHandler>
action Func<Task>
message string?
actionExpression string?
Returns

Task

No documentation is available.

DoesNotRaiseAny(Action<EventHandler>, Action<EventHandler>, Func<ValueTask>, string?, string?)

Assert.DoesNotRaise.cs

net10.0

public static Task DoesNotRaiseAny(Action<EventHandler> attach, Action<EventHandler> detach, Func<ValueTask> action, string? message = null, string? actionExpression = null)

net11.0

public static Task DoesNotRaiseAny(Action<EventHandler> attach, Action<EventHandler> detach, Func<ValueTask> action, string? message = null, string? actionExpression = null)
Parameters
attach Action<EventHandler>
detach Action<EventHandler>
action Func<ValueTask>
message string?
actionExpression string?
Returns

Task

No documentation is available.

DoesNotRaiseAny<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Action, string?, string?)

Assert.DoesNotRaise.cs
public static void DoesNotRaiseAny<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Action action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgs
Type parameters
TEventArgs
Parameters
attach Action<EventHandler<TEventArgs>>
detach Action<EventHandler<TEventArgs>>
action Action
message string?
actionExpression string?

No documentation is available.

DoesNotRaiseAny<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<Task>, string?, string?)

Assert.DoesNotRaise.cs

net10.0

public static Task DoesNotRaiseAny<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Func<Task> action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgs

net11.0

public static Task DoesNotRaiseAny<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Func<Task> action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgs
Type parameters
TEventArgs
Parameters
attach Action<EventHandler<TEventArgs>>
detach Action<EventHandler<TEventArgs>>
action Func<Task>
message string?
actionExpression string?
Returns

Task

No documentation is available.

DoesNotRaiseAny<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<ValueTask>, string?, string?)

Assert.DoesNotRaise.cs

net10.0

public static Task DoesNotRaiseAny<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Func<ValueTask> action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgs

net11.0

public static Task DoesNotRaiseAny<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Func<ValueTask> action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgs
Type parameters
TEventArgs
Parameters
attach Action<EventHandler<TEventArgs>>
detach Action<EventHandler<TEventArgs>>
action Func<ValueTask>
message string?
actionExpression string?
Returns

Task

No documentation is available.

DoesNotStartWith overloads

DoesNotStartWith(char, string?, IEqualityComparer<char>?, string?, string?, string?)

Assert.DoesNotStartWith.cs
public static void DoesNotStartWith(char expected, string? actual, IEqualityComparer<char>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected char
actual string?
comparer IEqualityComparer<char>?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotStartWith(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)

Assert.DoesNotStartWith.cs
public static void DoesNotStartWith(IEnumerable expected, IEnumerable? actual, IEqualityComparer? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected IEnumerable
actual IEnumerable?
comparer IEqualityComparer?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotStartWith(object?, IEnumerable?, string?, string?, string?)

Assert.DoesNotStartWith.cs
public static void DoesNotStartWith(object? expected, IEnumerable? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected object?
actual IEnumerable?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotStartWith(ReadOnlySpan<char>, ReadOnlySpan<char>, bool, string?, string?, string?)

Assert.DoesNotStartWith.cs
public static void DoesNotStartWith(ReadOnlySpan<char> expected, ReadOnlySpan<char> actual, bool ignoreCase = false, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected ReadOnlySpan<char>
actual ReadOnlySpan<char>
ignoreCase bool
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotStartWith(ReadOnlySpan<char>, ReadOnlySpan<char>, StringComparison, string?, string?, string?)

Assert.DoesNotStartWith.cs
public static void DoesNotStartWith(ReadOnlySpan<char> expected, ReadOnlySpan<char> actual, StringComparison comparisonType, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected ReadOnlySpan<char>
actual ReadOnlySpan<char>
comparisonType StringComparison
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotStartWith(string, string?, bool, string?, string?, string?)

Assert.DoesNotStartWith.cs
public static void DoesNotStartWith(string expected, string? actual, bool ignoreCase = false, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected string
actual string?
ignoreCase bool
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotStartWith(string, string?, StringComparison, string?, string?, string?)

Assert.DoesNotStartWith.cs
public static void DoesNotStartWith(string expected, string? actual, StringComparison comparisonType, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected string
actual string?
comparisonType StringComparison
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotStartWith<T>(IEnumerable<T>, IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)

Assert.DoesNotStartWith.cs

net10.0

public static Task DoesNotStartWith<T>(IEnumerable<T> expected, IAsyncEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)

net11.0

public static Task DoesNotStartWith<T>(IEnumerable<T> expected, IAsyncEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected IEnumerable<T>
actual IAsyncEnumerable<T>?
comparer IEqualityComparer<T>?
message string?
actualExpression string?
expectedExpression string?
Returns

Task

No documentation is available.

DoesNotStartWith<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)

Assert.DoesNotStartWith.cs
public static void DoesNotStartWith<T>(IEnumerable<T> expected, IEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected IEnumerable<T>
actual IEnumerable<T>?
comparer IEqualityComparer<T>?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotStartWith<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)

Assert.DoesNotStartWith.cs
public static void DoesNotStartWith<T>(ReadOnlySpan<T> expected, ReadOnlySpan<T> actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected ReadOnlySpan<T>
actual ReadOnlySpan<T>
comparer IEqualityComparer<T>?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotStartWith<T>(T, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)

Assert.DoesNotStartWith.cs
public static void DoesNotStartWith<T>(T expected, IEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected T
actual IEnumerable<T>?
comparer IEqualityComparer<T>?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotStartWith<T>(T, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)

Assert.DoesNotStartWith.cs
public static void DoesNotStartWith<T>(T expected, ReadOnlySpan<T> actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected T
actual ReadOnlySpan<T>
comparer IEqualityComparer<T>?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotStartWith<T>(T, T[]?, IEqualityComparer<T>?, string?, string?, string?)

Assert.DoesNotStartWith.cs
public static void DoesNotStartWith<T>(T expected, T[]? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected T
actual T[]?
comparer IEqualityComparer<T>?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

DoesNotThrow overloads

DoesNotThrow(Action, string?, string?)

Assert.DoesNotThrow.cs
public static void DoesNotThrow(Action action, string? message = null, string? actionExpression = null)
Parameters
action Action
message string?
actionExpression string?

No documentation is available.

DoesNotThrow(Func<object?>, string?, string?)

Assert.DoesNotThrow.cs
public static void DoesNotThrow(Func<object?> action, string? message = null, string? actionExpression = null)
Parameters
action Func<object?>
message string?
actionExpression string?

No documentation is available.

DoesNotThrow(Func<Task>, string?, string?)

Assert.DoesNotThrow.cs

net10.0

public static Task DoesNotThrow(Func<Task> action, string? message = null, string? actionExpression = null)

net11.0

public static Task DoesNotThrow(Func<Task> action, string? message = null, string? actionExpression = null)
Parameters
action Func<Task>
message string?
actionExpression string?
Returns

Task

No documentation is available.

DoesNotThrow(Func<ValueTask>, string?, string?)

Assert.DoesNotThrow.cs

net10.0

public static Task DoesNotThrow(Func<ValueTask> action, string? message = null, string? actionExpression = null)

net11.0

public static Task DoesNotThrow(Func<ValueTask> action, string? message = null, string? actionExpression = null)
Parameters
action Func<ValueTask>
message string?
actionExpression string?
Returns

Task

No documentation is available.

DoesNotThrow(Type, Action, string?, string?)

Assert.DoesNotThrow.cs
public static void DoesNotThrow(Type exceptionType, Action action, string? message = null, string? actionExpression = null)
Parameters
exceptionType Type
action Action
message string?
actionExpression string?

No documentation is available.

DoesNotThrow(Type, Func<object?>, string?, string?)

Assert.DoesNotThrow.cs
public static void DoesNotThrow(Type exceptionType, Func<object?> action, string? message = null, string? actionExpression = null)
Parameters
exceptionType Type
action Func<object?>
message string?
actionExpression string?

No documentation is available.

DoesNotThrow(Type, Func<Task>, string?, string?)

Assert.DoesNotThrow.cs

net10.0

public static Task DoesNotThrow(Type exceptionType, Func<Task> action, string? message = null, string? actionExpression = null)

net11.0

public static Task DoesNotThrow(Type exceptionType, Func<Task> action, string? message = null, string? actionExpression = null)
Parameters
exceptionType Type
action Func<Task>
message string?
actionExpression string?
Returns

Task

No documentation is available.

DoesNotThrow(Type, Func<ValueTask>, string?, string?)

Assert.DoesNotThrow.cs

net10.0

public static Task DoesNotThrow(Type exceptionType, Func<ValueTask> action, string? message = null, string? actionExpression = null)

net11.0

public static Task DoesNotThrow(Type exceptionType, Func<ValueTask> action, string? message = null, string? actionExpression = null)
Parameters
exceptionType Type
action Func<ValueTask>
message string?
actionExpression string?
Returns

Task

No documentation is available.

DoesNotThrow<T>(Action, string?, string?)

Assert.DoesNotThrow.cs
public static void DoesNotThrow<T>(Action action, string? message = null, string? actionExpression = null) where T : Exception
Type parameters
T
Parameters
action Action
message string?
actionExpression string?

No documentation is available.

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

Assert.DoesNotThrow.cs
public static void DoesNotThrow<T>(Func<object?> action, string? message = null, string? actionExpression = null) where T : Exception
Type parameters
T
Parameters
action Func<object?>
message string?
actionExpression string?

No documentation is available.

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

Assert.DoesNotThrow.cs

net10.0

public static Task DoesNotThrow<T>(Func<Task> action, string? message = null, string? actionExpression = null) where T : Exception

net11.0

public static Task DoesNotThrow<T>(Func<Task> action, string? message = null, string? actionExpression = null) where T : Exception
Type parameters
T
Parameters
action Func<Task>
message string?
actionExpression string?
Returns

Task

No documentation is available.

DoesNotThrow<T>(Func<ValueTask>, string?, string?)

Assert.DoesNotThrow.cs

net10.0

public static Task DoesNotThrow<T>(Func<ValueTask> action, string? message = null, string? actionExpression = null) where T : Exception

net11.0

public static Task DoesNotThrow<T>(Func<ValueTask> action, string? message = null, string? actionExpression = null) where T : Exception
Type parameters
T
Parameters
action Func<ValueTask>
message string?
actionExpression string?
Returns

Task

No documentation is available.

DoesNotThrowAny overloads

DoesNotThrowAny(Type, Action, string?, string?)

Assert.DoesNotThrow.cs
public static void DoesNotThrowAny(Type exceptionType, Action action, string? message = null, string? actionExpression = null)
Parameters
exceptionType Type
action Action
message string?
actionExpression string?

No documentation is available.

DoesNotThrowAny(Type, Func<object?>, string?, string?)

Assert.DoesNotThrow.cs
public static void DoesNotThrowAny(Type exceptionType, Func<object?> action, string? message = null, string? actionExpression = null)
Parameters
exceptionType Type
action Func<object?>
message string?
actionExpression string?

No documentation is available.

DoesNotThrowAny(Type, Func<Task>, string?, string?)

Assert.DoesNotThrow.cs

net10.0

public static Task DoesNotThrowAny(Type exceptionType, Func<Task> action, string? message = null, string? actionExpression = null)

net11.0

public static Task DoesNotThrowAny(Type exceptionType, Func<Task> action, string? message = null, string? actionExpression = null)
Parameters
exceptionType Type
action Func<Task>
message string?
actionExpression string?
Returns

Task

No documentation is available.

DoesNotThrowAny(Type, Func<ValueTask>, string?, string?)

Assert.DoesNotThrow.cs

net10.0

public static Task DoesNotThrowAny(Type exceptionType, Func<ValueTask> action, string? message = null, string? actionExpression = null)

net11.0

public static Task DoesNotThrowAny(Type exceptionType, Func<ValueTask> action, string? message = null, string? actionExpression = null)
Parameters
exceptionType Type
action Func<ValueTask>
message string?
actionExpression string?
Returns

Task

No documentation is available.

DoesNotThrowAny<T>(Action, string?, string?)

Assert.DoesNotThrow.cs
public static void DoesNotThrowAny<T>(Action action, string? message = null, string? actionExpression = null) where T : Exception
Type parameters
T
Parameters
action Action
message string?
actionExpression string?

No documentation is available.

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

Assert.DoesNotThrow.cs
public static void DoesNotThrowAny<T>(Func<object?> action, string? message = null, string? actionExpression = null) where T : Exception
Type parameters
T
Parameters
action Func<object?>
message string?
actionExpression string?

No documentation is available.

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

Assert.DoesNotThrow.cs

net10.0

public static Task DoesNotThrowAny<T>(Func<Task> action, string? message = null, string? actionExpression = null) where T : Exception

net11.0

public static Task DoesNotThrowAny<T>(Func<Task> action, string? message = null, string? actionExpression = null) where T : Exception
Type parameters
T
Parameters
action Func<Task>
message string?
actionExpression string?
Returns

Task

No documentation is available.

DoesNotThrowAny<T>(Func<ValueTask>, string?, string?)

Assert.DoesNotThrow.cs

net10.0

public static Task DoesNotThrowAny<T>(Func<ValueTask> action, string? message = null, string? actionExpression = null) where T : Exception

net11.0

public static Task DoesNotThrowAny<T>(Func<ValueTask> action, string? message = null, string? actionExpression = null) where T : Exception
Type parameters
T
Parameters
action Func<ValueTask>
message string?
actionExpression string?
Returns

Task

No documentation is available.

Empty overloads

Empty(IEnumerable?, string?, string?)

Assert.Empty.cs

Asserts that a non-generic enumerable is not null and is empty.

public static void Empty(IEnumerable? actual, string? message = null, string? actualExpression = null)
Parameters
actual IEnumerable?
The enumerable to inspect.
message string?
actualExpression string?
The expression that produced the actual value.

Empty(string?, string?, string?)

Assert.Empty.cs

Asserts that a string is not null and is empty.

public static void Empty(string? actual, string? message = null, string? actualExpression = null)
Parameters
actual string?
The string to inspect.
message string?
actualExpression string?
The expression that produced the actual value.

Empty<T>(IAsyncEnumerable<T>?, string?, string?)

Assert.Empty.cs

Asserts that an asynchronous sequence is not null and is empty.

net10.0

public static Task Empty<T>(IAsyncEnumerable<T>? actual, string? message = null, string? actualExpression = null)

net11.0

public static Task Empty<T>(IAsyncEnumerable<T>? actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual IAsyncEnumerable<T>?
The sequence to inspect.
message string?
actualExpression string?
The expression that produced the actual value.
Returns

Task

Empty<T>(IEnumerable<T>?, string?, string?)

Assert.Empty.cs

Asserts that an enumerable is not null and is empty.

public static void Empty<T>(IEnumerable<T>? actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual IEnumerable<T>?
The enumerable to inspect.
message string?
actualExpression string?
The expression that produced the actual value.

Empty<T>(ReadOnlySpan<T>, string?, string?)

Assert.Empty.cs

Asserts that a span is empty.

public static void Empty<T>(ReadOnlySpan<T> actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual ReadOnlySpan<T>
The span to inspect.
message string?
actualExpression string?
The expression that produced the actual value.

Empty<T>(T[]?, string?, string?)

Assert.Empty.cs

Asserts that an array is not null and is empty.

public static void Empty<T>(T[]? actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual T[]?
The array to inspect.
message string?
actualExpression string?
The expression that produced the actual value.
Remarks

Arrays would otherwise bind to the ReadOnlySpan<T> overload, which turns a null array into an empty span.

EndsWith overloads

EndsWith(char, string?, IEqualityComparer<char>?, string?, string?, string?)

Assert.EndsWith.cs

Asserts that a string ends with the specified character.

public static void EndsWith(char expected, string? actual, IEqualityComparer<char>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected char
The character expected at the end of actual.
actual string?
The string to inspect.
comparer IEqualityComparer<char>?
The comparer used to compare characters.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

EndsWith(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)

Assert.EndsWith.cs

Asserts that a non-generic enumerable ends with the specified non-generic suffix.

public static void EndsWith(IEnumerable expected, IEnumerable? actual, IEqualityComparer? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected IEnumerable
The suffix expected at the end of actual. Without comparer, the assertion also succeeds when expected is itself the last item of actual. A string is compared as an item, unless actual is a sequence of characters.
actual IEnumerable?
The enumerable to inspect.
comparer IEqualityComparer?
The comparer used to compare values.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

EndsWith(object?, IEnumerable?, string?, string?, string?)

Assert.EndsWith.cs

Asserts that a non-generic enumerable ends with the specified value.

public static void EndsWith(object? expected, IEnumerable? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected object?
The value expected at the end of actual. A string compared to a sequence of characters is compared as a suffix.
actual IEnumerable?
The enumerable to inspect.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

EndsWith(ReadOnlySpan<char>, ReadOnlySpan<char>, bool, string?, string?, string?)

Assert.EndsWith.cs

Asserts that a character span ends with the specified suffix.

public static void EndsWith(ReadOnlySpan<char> expected, ReadOnlySpan<char> actual, bool ignoreCase = false, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected ReadOnlySpan<char>
The suffix expected at the end of actual.
actual ReadOnlySpan<char>
The span to inspect.
ignoreCase bool
When true, the comparison ignores casing (OrdinalIgnoreCase); otherwise, it is case-sensitive (Ordinal).
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

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

Assert.EndsWith.cs

Asserts that a character span ends with the specified suffix.

public static void EndsWith(ReadOnlySpan<char> expected, ReadOnlySpan<char> actual, StringComparison comparisonType, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected ReadOnlySpan<char>
The suffix expected at the end of actual.
actual ReadOnlySpan<char>
The span to inspect.
comparisonType StringComparison
The comparison used to compare expected with the end of actual.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

EndsWith(string, string?, bool, string?, string?, string?)

Assert.EndsWith.cs

Asserts that a string ends with the specified suffix.

public static void EndsWith(string expected, string? actual, bool ignoreCase = false, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected string
The suffix expected at the end of actual.
actual string?
The string to inspect.
ignoreCase bool
When true, the comparison ignores casing (OrdinalIgnoreCase); otherwise, it is case-sensitive (Ordinal).
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

EndsWith(string, string?, StringComparison, string?, string?, string?)

Assert.EndsWith.cs

Asserts that a string ends with the specified suffix.

public static void EndsWith(string expected, string? actual, StringComparison comparisonType, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected string
The suffix expected at the end of actual.
actual string?
The string to inspect.
comparisonType StringComparison
The comparison used to compare expected with the end of actual.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

EndsWith<T>(IEnumerable<T>, IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)

Assert.EndsWith.cs

Asserts that an asynchronous sequence ends with the specified suffix.

net10.0

public static Task EndsWith<T>(IEnumerable<T> expected, IAsyncEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)

net11.0

public static Task EndsWith<T>(IEnumerable<T> expected, IAsyncEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected IEnumerable<T>
The suffix expected at the end of actual. When expected is itself the last item of actual, the assertion also succeeds.
actual IAsyncEnumerable<T>?
The sequence to inspect.
comparer IEqualityComparer<T>?
The comparer used to compare values.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.
Returns

Task

EndsWith<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)

Assert.EndsWith.cs

Asserts that an enumerable ends with the specified suffix.

public static void EndsWith<T>(IEnumerable<T> expected, IEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected IEnumerable<T>
The suffix expected at the end of actual. When expected is itself the last item of actual, the assertion also succeeds.
actual IEnumerable<T>?
The enumerable to inspect.
comparer IEqualityComparer<T>?
The comparer used to compare values.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

EndsWith<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)

Assert.EndsWith.cs

Asserts that a span ends with the specified suffix.

public static void EndsWith<T>(ReadOnlySpan<T> expected, ReadOnlySpan<T> actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected ReadOnlySpan<T>
The suffix expected at the end of actual.
actual ReadOnlySpan<T>
The span to inspect.
comparer IEqualityComparer<T>?
The comparer used to compare values.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

EndsWith<T>(T, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)

Assert.EndsWith.cs

Asserts that an enumerable ends with the specified value.

public static void EndsWith<T>(T expected, IEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected T
The value expected at the end of actual.
actual IEnumerable<T>?
The enumerable to inspect.
comparer IEqualityComparer<T>?
The comparer used to compare values.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

EndsWith<T>(T, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)

Assert.EndsWith.cs

Asserts that a span ends with the specified value.

public static void EndsWith<T>(T expected, ReadOnlySpan<T> actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected T
The value expected at the end of actual.
actual ReadOnlySpan<T>
The span to inspect.
comparer IEqualityComparer<T>?
The comparer used to compare values.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

EndsWith<T>(T, T[]?, IEqualityComparer<T>?, string?, string?, string?)

Assert.EndsWith.cs

Asserts that an array ends with the specified value.

public static void EndsWith<T>(T expected, T[]? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected T
The value expected at the end of actual.
actual T[]?
The array to inspect.
comparer IEqualityComparer<T>?
The comparer used to compare values.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

Equal overloads

Equal(IEnumerable?, IEnumerable?, IEqualityComparer?, string?, string?, string?)

Assert.Equal.cs
public static void Equal(IEnumerable? expected, IEnumerable? actual, IEqualityComparer? comparer, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected IEnumerable?
actual IEnumerable?
comparer IEqualityComparer?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

Equal(IEnumerable?, IEnumerable?, string?, string?, string?)

Assert.Equal.cs
public static void Equal(IEnumerable? expected, IEnumerable? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected IEnumerable?
actual IEnumerable?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

Equal(DateTime, DateTime, TimeSpan, string?, string?, string?)

Assert.Equal.cs
public static void Equal(DateTime expected, DateTime actual, TimeSpan precision, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected DateTime
actual DateTime
precision TimeSpan
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

Equal(DateTimeOffset, DateTimeOffset, TimeSpan, string?, string?, string?)

Assert.Equal.cs
public static void Equal(DateTimeOffset expected, DateTimeOffset actual, TimeSpan precision, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected DateTimeOffset
actual DateTimeOffset
precision TimeSpan
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

Equal(decimal, decimal, decimal, string?, string?, string?)

Assert.Equal.cs
public static void Equal(decimal expected, decimal actual, decimal tolerance, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected decimal
actual decimal
tolerance decimal
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

Equal(decimal, decimal, int, MidpointRounding, string?, string?, string?)

Assert.Equal.cs
public static void Equal(decimal expected, decimal actual, int precision, MidpointRounding rounding, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected decimal
actual decimal
precision int
rounding MidpointRounding
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

Equal(decimal, decimal, int, string?, string?, string?)

Assert.Equal.cs
public static void Equal(decimal expected, decimal actual, int precision, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected decimal
actual decimal
precision int
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

Equal(double, double, double, string?, string?, string?)

Assert.Equal.cs
public static void Equal(double expected, double actual, double tolerance, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected double
actual double
tolerance double
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

Equal(double, double, int, MidpointRounding, string?, string?, string?)

Assert.Equal.cs
public static void Equal(double expected, double actual, int precision, MidpointRounding rounding, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected double
actual double
precision int
rounding MidpointRounding
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

Equal(double, double, int, string?, string?, string?)

Assert.Equal.cs
public static void Equal(double expected, double actual, int precision, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected double
actual double
precision int
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

Equal(Half, Half, Half, string?, string?, string?)

Assert.Equal.cs
public static void Equal(Half expected, Half actual, Half tolerance, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected Half
actual Half
tolerance Half
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

Equal(object?, object?, string?, string?, string?)

Assert.Equal.cs
public static void Equal(object? expected, object? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected object?
actual object?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

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

Assert.Equal.cs
public static void Equal(ReadOnlySpan<char> expected, ReadOnlySpan<char> actual, bool ignoreCase = false, bool ignoreLineEndingDifferences = false, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected ReadOnlySpan<char>
actual ReadOnlySpan<char>
ignoreCase bool
ignoreLineEndingDifferences bool
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

Equal(float, float, int, MidpointRounding, string?, string?, string?)

Assert.Equal.cs
public static void Equal(float expected, float actual, int precision, MidpointRounding rounding, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected float
actual float
precision int
rounding MidpointRounding
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

Equal(float, float, int, string?, string?, string?)

Assert.Equal.cs
public static void Equal(float expected, float actual, int precision, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected float
actual float
precision int
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

Equal(float, float, float, string?, string?, string?)

Assert.Equal.cs
public static void Equal(float expected, float actual, float tolerance, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected float
actual float
tolerance float
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

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

Assert.Equal.cs
public static void Equal(string? expected, string? actual, bool ignoreCase = false, bool ignoreLineEndingDifferences = false, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected string?
actual string?
ignoreCase bool
ignoreLineEndingDifferences bool
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

Equal<T>(IAsyncEnumerable<T>?, IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)

Assert.Equal.cs

net10.0

public static Task Equal<T>(IAsyncEnumerable<T>? expected, IAsyncEnumerable<T>? actual, IEqualityComparer<T>? comparer, string? message = null, string? actualExpression = null, string? expectedExpression = null)

net11.0

public static Task Equal<T>(IAsyncEnumerable<T>? expected, IAsyncEnumerable<T>? actual, IEqualityComparer<T>? comparer, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected IAsyncEnumerable<T>?
actual IAsyncEnumerable<T>?
comparer IEqualityComparer<T>?
message string?
actualExpression string?
expectedExpression string?
Returns

Task

No documentation is available.

Equal<T>(IAsyncEnumerable<T>?, IAsyncEnumerable<T>?, string?, string?, string?)

Assert.Equal.cs

net10.0

public static Task Equal<T>(IAsyncEnumerable<T>? expected, IAsyncEnumerable<T>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)

net11.0

public static Task Equal<T>(IAsyncEnumerable<T>? expected, IAsyncEnumerable<T>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected IAsyncEnumerable<T>?
actual IAsyncEnumerable<T>?
message string?
actualExpression string?
expectedExpression string?
Returns

Task

No documentation is available.

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

Assert.Equal.cs

net10.0

public static Task Equal<T>(IAsyncEnumerable<T>? expected, IEnumerable<T>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)

net11.0

public static Task Equal<T>(IAsyncEnumerable<T>? expected, IEnumerable<T>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected IAsyncEnumerable<T>?
actual IEnumerable<T>?
message string?
actualExpression string?
expectedExpression string?
Returns

Task

No documentation is available.

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

Assert.Equal.cs

net10.0

public static Task Equal<T>(IEnumerable<T>? expected, IAsyncEnumerable<T>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)

net11.0

public static Task Equal<T>(IEnumerable<T>? expected, IAsyncEnumerable<T>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected IEnumerable<T>?
actual IAsyncEnumerable<T>?
message string?
actualExpression string?
expectedExpression string?
Returns

Task

No documentation is available.

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

Assert.Equal.cs
public static void Equal<T>(IEnumerable<T>? expected, IEnumerable<T>? actual, IEqualityComparer<T>? comparer, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected IEnumerable<T>?
actual IEnumerable<T>?
comparer IEqualityComparer<T>?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

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

Assert.Equal.cs
public static void Equal<T>(IEnumerable<T>? expected, IEnumerable<T>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected IEnumerable<T>?
actual IEnumerable<T>?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

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

Assert.Equal.cs
public static void Equal<T>(ReadOnlySpan<T> expected, ReadOnlySpan<T> actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected ReadOnlySpan<T>
actual ReadOnlySpan<T>
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

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

Assert.Equal.cs

Verifies that two values are equal according to comparer.

public static void Equal<T>(T expected, T actual, IEqualityComparer<T>? comparer, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected T
actual T
comparer IEqualityComparer<T>?
message string?
actualExpression string?
expectedExpression string?
Remarks

When comparer is null, the values are compared the way Assert.Equal(expected, actual) compares them.

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

Assert.Equal.cs
public static void Equal<T>(T expected, T? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected T
actual T?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

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

Assert.Equal.cs
public static void Equal<T>(T expected, T actual, T tolerance, string? message = null, string? actualExpression = null, string? expectedExpression = null) where T : IFloatingPoint<T>
Type parameters
T
Parameters
expected T
actual T
tolerance T
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

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

Assert.Equal.cs

Verifies that two values of a ref struct type are equal according to IEquatable<T>.Equals.

public static void Equal<T>(scoped in T expected, scoped in T actual, string? message = null, string? actualExpression = null, string? expectedExpression = null) where T : IEquatable<T>, allows ref struct
Type parameters
T
Parameters
expected T
actual T
message string?
actualExpression string?
expectedExpression string?
Remarks

This overload is used only when no other overload applies, such as for a ref struct that implements IEquatable<T>. A ref struct value cannot be boxed, so the failure message shows the type of the values instead of the values.

Equal<T>(T[]?, T[]?, string?, string?, string?)

Assert.Equal.cs
public static void Equal<T>(T[]? expected, T[]? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected T[]?
actual T[]?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

Equal<TExpected, TActual>(IAsyncEnumerable<TExpected>?, IAsyncEnumerable<TActual>?, string?, string?, string?)

Assert.Equal.cs

net10.0

public static Task Equal<TExpected, TActual>(IAsyncEnumerable<TExpected>? expected, IAsyncEnumerable<TActual>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)

net11.0

public static Task Equal<TExpected, TActual>(IAsyncEnumerable<TExpected>? expected, IAsyncEnumerable<TActual>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
TExpected
TActual
Parameters
expected IAsyncEnumerable<TExpected>?
actual IAsyncEnumerable<TActual>?
message string?
actualExpression string?
expectedExpression string?
Returns

Task

No documentation is available.

Equal<TExpected, TActual>(IEnumerable<TExpected>?, IEnumerable<TActual>?, string?, string?, string?)

Assert.Equal.cs
public static void Equal<TExpected, TActual>(IEnumerable<TExpected>? expected, IEnumerable<TActual>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
TExpected
TActual
Parameters
expected IEnumerable<TExpected>?
actual IEnumerable<TActual>?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

Equal<TExpected, TActual>(ReadOnlyMemory<TExpected>, ReadOnlyMemory<TActual>, string?, string?, string?)

Assert.Equal.cs
public static void Equal<TExpected, TActual>(ReadOnlyMemory<TExpected> expected, ReadOnlyMemory<TActual> actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
TExpected
TActual
Parameters
expected ReadOnlyMemory<TExpected>
actual ReadOnlyMemory<TActual>
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

Equal<TExpected, TActual>(ReadOnlySpan<TExpected>, ReadOnlySpan<TActual>, string?, string?, string?)

Assert.Equal.cs
public static void Equal<TExpected, TActual>(ReadOnlySpan<TExpected> expected, ReadOnlySpan<TActual> actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
TExpected
TActual
Parameters
expected ReadOnlySpan<TExpected>
actual ReadOnlySpan<TActual>
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

EqualUnordered overloads

EqualUnordered(IEnumerable?, IEnumerable?, IEqualityComparer?, string?, string?, string?)

Assert.EqualUnordered.cs
public static void EqualUnordered(IEnumerable? expected, IEnumerable? actual, IEqualityComparer? comparer, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected IEnumerable?
actual IEnumerable?
comparer IEqualityComparer?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

EqualUnordered(IEnumerable?, IEnumerable?, string?, string?, string?)

Assert.EqualUnordered.cs
public static void EqualUnordered(IEnumerable? expected, IEnumerable? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected IEnumerable?
actual IEnumerable?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

EqualUnordered<T>(IAsyncEnumerable<T>?, IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)

Assert.EqualUnordered.cs

Asserts that two sequences contain the same items, regardless of their order.

net10.0

public static Task EqualUnordered<T>(IAsyncEnumerable<T>? expected, IAsyncEnumerable<T>? actual, IEqualityComparer<T>? comparer, string? message = null, string? actualExpression = null, string? expectedExpression = null)

net11.0

public static Task EqualUnordered<T>(IAsyncEnumerable<T>? expected, IAsyncEnumerable<T>? actual, IEqualityComparer<T>? comparer, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected IAsyncEnumerable<T>?
actual IAsyncEnumerable<T>?
comparer IEqualityComparer<T>?
The comparer used to compare items. When null, items are compared like Assert.Equal compares two values.
message string?
actualExpression string?
expectedExpression string?
Returns

Task

EqualUnordered<T>(IAsyncEnumerable<T>?, IAsyncEnumerable<T>?, string?, string?, string?)

Assert.EqualUnordered.cs

Asserts that two sequences contain the same items, regardless of their order.

net10.0

public static Task EqualUnordered<T>(IAsyncEnumerable<T>? expected, IAsyncEnumerable<T>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)

net11.0

public static Task EqualUnordered<T>(IAsyncEnumerable<T>? expected, IAsyncEnumerable<T>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected IAsyncEnumerable<T>?
actual IAsyncEnumerable<T>?
message string?
actualExpression string?
expectedExpression string?
Returns

Task

Remarks

Items are compared like Assert.Equal compares two values, so nested collections are compared by content and numbers of different types by value. Two null sequences are equal.

EqualUnordered<T>(IEnumerable<T>?, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)

Assert.EqualUnordered.cs

Asserts that two sequences contain the same items, regardless of their order.

public static void EqualUnordered<T>(IEnumerable<T>? expected, IEnumerable<T>? actual, IEqualityComparer<T>? comparer, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected IEnumerable<T>?
actual IEnumerable<T>?
comparer IEqualityComparer<T>?
The comparer used to compare items. When null, items are compared like Assert.Equal compares two values.
message string?
actualExpression string?
expectedExpression string?

EqualUnordered<T>(IEnumerable<T>?, IEnumerable<T>?, string?, string?, string?)

Assert.EqualUnordered.cs

Asserts that two sequences contain the same items, regardless of their order.

public static void EqualUnordered<T>(IEnumerable<T>? expected, IEnumerable<T>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected IEnumerable<T>?
actual IEnumerable<T>?
message string?
actualExpression string?
expectedExpression string?
Remarks

Items are compared like Assert.Equal compares two values, so nested collections are compared by content and numbers of different types by value. Two null sequences are equal.

EqualUnordered<TExpected, TActual>(IAsyncEnumerable<TExpected>?, IAsyncEnumerable<TActual>?, string?, string?, string?)

Assert.EqualUnordered.cs

net10.0

public static Task EqualUnordered<TExpected, TActual>(IAsyncEnumerable<TExpected>? expected, IAsyncEnumerable<TActual>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)

net11.0

public static Task EqualUnordered<TExpected, TActual>(IAsyncEnumerable<TExpected>? expected, IAsyncEnumerable<TActual>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
TExpected
TActual
Parameters
expected IAsyncEnumerable<TExpected>?
actual IAsyncEnumerable<TActual>?
message string?
actualExpression string?
expectedExpression string?
Returns

Task

No documentation is available.

EqualUnordered<TExpected, TActual>(IEnumerable<TExpected>?, IEnumerable<TActual>?, string?, string?, string?)

Assert.EqualUnordered.cs
public static void EqualUnordered<TExpected, TActual>(IEnumerable<TExpected>? expected, IEnumerable<TActual>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
TExpected
TActual
Parameters
expected IEnumerable<TExpected>?
actual IEnumerable<TActual>?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

Equals(object?, object?)

Assert.cs
  • Obsolete: This is an override of Object.Equals(). Use Assert.Equal() instead.
[Obsolete("This is an override of Object.Equals(). Use Assert.Equal() instead.", true)]
public new static bool Equals(object? a, object? b)

Parameters

a object?
b object?

Returns

bool

No documentation is available.

Equivalent overloads

Equivalent(object?, object?, EquivalentOptions?, string?, string?, string?)

Assert.Equivalent.cs
public static void Equivalent(object? expected, object? actual, EquivalentOptions? options, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected object?
actual object?
options EquivalentOptions?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

Equivalent(object?, object?, string?, string?, string?)

Assert.Equivalent.cs
public static void Equivalent(object? expected, object? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected object?
actual object?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

Fail(string?)

Assert.cs

Fails the assertion with the specified message.

public static void Fail(string? message = null)

Parameters

message string?
The message that describes the failure.

False overloads

False(bool, string?, string?)

Assert.False.cs

Asserts that a condition is false. If the condition is true, an AssertionException is thrown.

public static void False(bool condition, string? message = null, string? expression = null)
Parameters
condition bool
The condition to evaluate.
message string?
The message that describes the failure.
expression string?
The expression that caused the failure.

False(bool?, string?, string?)

Assert.False.cs

Asserts that a nullable condition is false. If the condition is true or null, an AssertionException is thrown.

public static void False(bool? condition, string? message = null, string? expression = null)
Parameters
condition bool?
The nullable condition to evaluate.
message string?
The message that describes the failure.
expression string?
The expression that caused the failure.

HasCount overloads

HasCount(int, IEnumerable?, string?, string?)

Assert.Count.cs
public static void HasCount(int expectedCount, IEnumerable? actual, string? message = null, string? actualExpression = null)
Parameters
expectedCount int
actual IEnumerable?
message string?
actualExpression string?

No documentation is available.

HasCount(int, string?, string?, string?)

Assert.Count.cs
public static void HasCount(int expectedCount, string? actual, string? message = null, string? actualExpression = null)
Parameters
expectedCount int
actual string?
message string?
actualExpression string?

No documentation is available.

HasCount<T>(int, IAsyncEnumerable<T>?, string?, string?)

Assert.Count.cs

net10.0

public static Task HasCount<T>(int expectedCount, IAsyncEnumerable<T>? actual, string? message = null, string? actualExpression = null)

net11.0

public static Task HasCount<T>(int expectedCount, IAsyncEnumerable<T>? actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
expectedCount int
actual IAsyncEnumerable<T>?
message string?
actualExpression string?
Returns

Task

No documentation is available.

HasCount<T>(int, IEnumerable<T>?, string?, string?)

Assert.Count.cs
public static void HasCount<T>(int expectedCount, IEnumerable<T>? actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
expectedCount int
actual IEnumerable<T>?
message string?
actualExpression string?

No documentation is available.

HasCount<T>(int, ReadOnlySpan<T>, string?, string?)

Assert.Count.cs
public static void HasCount<T>(int expectedCount, ReadOnlySpan<T> actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
expectedCount int
actual ReadOnlySpan<T>
message string?
actualExpression string?

No documentation is available.

HasCount<T>(int, T[]?, string?, string?)

Assert.Count.cs
public static void HasCount<T>(int expectedCount, T[]? actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
expectedCount int
actual T[]?
message string?
actualExpression string?

No documentation is available.

HasCountGreaterThan overloads

HasCountGreaterThan(int, IEnumerable?, string?, string?)

Assert.Count.cs
public static void HasCountGreaterThan(int expectedCount, IEnumerable? actual, string? message = null, string? actualExpression = null)
Parameters
expectedCount int
actual IEnumerable?
message string?
actualExpression string?

No documentation is available.

HasCountGreaterThan(int, string?, string?, string?)

Assert.Count.cs
public static void HasCountGreaterThan(int expectedCount, string? actual, string? message = null, string? actualExpression = null)
Parameters
expectedCount int
actual string?
message string?
actualExpression string?

No documentation is available.

HasCountGreaterThan<T>(int, IAsyncEnumerable<T>?, string?, string?)

Assert.Count.cs

net10.0

public static Task HasCountGreaterThan<T>(int expectedCount, IAsyncEnumerable<T>? actual, string? message = null, string? actualExpression = null)

net11.0

public static Task HasCountGreaterThan<T>(int expectedCount, IAsyncEnumerable<T>? actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
expectedCount int
actual IAsyncEnumerable<T>?
message string?
actualExpression string?
Returns

Task

No documentation is available.

HasCountGreaterThan<T>(int, IEnumerable<T>?, string?, string?)

Assert.Count.cs
public static void HasCountGreaterThan<T>(int expectedCount, IEnumerable<T>? actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
expectedCount int
actual IEnumerable<T>?
message string?
actualExpression string?

No documentation is available.

HasCountGreaterThan<T>(int, ReadOnlySpan<T>, string?, string?)

Assert.Count.cs
public static void HasCountGreaterThan<T>(int expectedCount, ReadOnlySpan<T> actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
expectedCount int
actual ReadOnlySpan<T>
message string?
actualExpression string?

No documentation is available.

HasCountGreaterThan<T>(int, T[]?, string?, string?)

Assert.Count.cs
public static void HasCountGreaterThan<T>(int expectedCount, T[]? actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
expectedCount int
actual T[]?
message string?
actualExpression string?

No documentation is available.

HasCountGreaterThanOrEqual overloads

HasCountGreaterThanOrEqual(int, IEnumerable?, string?, string?)

Assert.Count.cs
public static void HasCountGreaterThanOrEqual(int expectedCount, IEnumerable? actual, string? message = null, string? actualExpression = null)
Parameters
expectedCount int
actual IEnumerable?
message string?
actualExpression string?

No documentation is available.

HasCountGreaterThanOrEqual(int, string?, string?, string?)

Assert.Count.cs
public static void HasCountGreaterThanOrEqual(int expectedCount, string? actual, string? message = null, string? actualExpression = null)
Parameters
expectedCount int
actual string?
message string?
actualExpression string?

No documentation is available.

HasCountGreaterThanOrEqual<T>(int, IAsyncEnumerable<T>?, string?, string?)

Assert.Count.cs

net10.0

public static Task HasCountGreaterThanOrEqual<T>(int expectedCount, IAsyncEnumerable<T>? actual, string? message = null, string? actualExpression = null)

net11.0

public static Task HasCountGreaterThanOrEqual<T>(int expectedCount, IAsyncEnumerable<T>? actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
expectedCount int
actual IAsyncEnumerable<T>?
message string?
actualExpression string?
Returns

Task

No documentation is available.

HasCountGreaterThanOrEqual<T>(int, IEnumerable<T>?, string?, string?)

Assert.Count.cs
public static void HasCountGreaterThanOrEqual<T>(int expectedCount, IEnumerable<T>? actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
expectedCount int
actual IEnumerable<T>?
message string?
actualExpression string?

No documentation is available.

HasCountGreaterThanOrEqual<T>(int, ReadOnlySpan<T>, string?, string?)

Assert.Count.cs
public static void HasCountGreaterThanOrEqual<T>(int expectedCount, ReadOnlySpan<T> actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
expectedCount int
actual ReadOnlySpan<T>
message string?
actualExpression string?

No documentation is available.

HasCountGreaterThanOrEqual<T>(int, T[]?, string?, string?)

Assert.Count.cs
public static void HasCountGreaterThanOrEqual<T>(int expectedCount, T[]? actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
expectedCount int
actual T[]?
message string?
actualExpression string?

No documentation is available.

HasCountLessThan overloads

HasCountLessThan(int, IEnumerable?, string?, string?)

Assert.Count.cs
public static void HasCountLessThan(int expectedCount, IEnumerable? actual, string? message = null, string? actualExpression = null)
Parameters
expectedCount int
actual IEnumerable?
message string?
actualExpression string?

No documentation is available.

HasCountLessThan(int, string?, string?, string?)

Assert.Count.cs
public static void HasCountLessThan(int expectedCount, string? actual, string? message = null, string? actualExpression = null)
Parameters
expectedCount int
actual string?
message string?
actualExpression string?

No documentation is available.

HasCountLessThan<T>(int, IAsyncEnumerable<T>?, string?, string?)

Assert.Count.cs

net10.0

public static Task HasCountLessThan<T>(int expectedCount, IAsyncEnumerable<T>? actual, string? message = null, string? actualExpression = null)

net11.0

public static Task HasCountLessThan<T>(int expectedCount, IAsyncEnumerable<T>? actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
expectedCount int
actual IAsyncEnumerable<T>?
message string?
actualExpression string?
Returns

Task

No documentation is available.

HasCountLessThan<T>(int, IEnumerable<T>?, string?, string?)

Assert.Count.cs
public static void HasCountLessThan<T>(int expectedCount, IEnumerable<T>? actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
expectedCount int
actual IEnumerable<T>?
message string?
actualExpression string?

No documentation is available.

HasCountLessThan<T>(int, ReadOnlySpan<T>, string?, string?)

Assert.Count.cs
public static void HasCountLessThan<T>(int expectedCount, ReadOnlySpan<T> actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
expectedCount int
actual ReadOnlySpan<T>
message string?
actualExpression string?

No documentation is available.

HasCountLessThan<T>(int, T[]?, string?, string?)

Assert.Count.cs
public static void HasCountLessThan<T>(int expectedCount, T[]? actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
expectedCount int
actual T[]?
message string?
actualExpression string?

No documentation is available.

HasCountLessThanOrEqual overloads

HasCountLessThanOrEqual(int, IEnumerable?, string?, string?)

Assert.Count.cs
public static void HasCountLessThanOrEqual(int expectedCount, IEnumerable? actual, string? message = null, string? actualExpression = null)
Parameters
expectedCount int
actual IEnumerable?
message string?
actualExpression string?

No documentation is available.

HasCountLessThanOrEqual(int, string?, string?, string?)

Assert.Count.cs
public static void HasCountLessThanOrEqual(int expectedCount, string? actual, string? message = null, string? actualExpression = null)
Parameters
expectedCount int
actual string?
message string?
actualExpression string?

No documentation is available.

HasCountLessThanOrEqual<T>(int, IAsyncEnumerable<T>?, string?, string?)

Assert.Count.cs

net10.0

public static Task HasCountLessThanOrEqual<T>(int expectedCount, IAsyncEnumerable<T>? actual, string? message = null, string? actualExpression = null)

net11.0

public static Task HasCountLessThanOrEqual<T>(int expectedCount, IAsyncEnumerable<T>? actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
expectedCount int
actual IAsyncEnumerable<T>?
message string?
actualExpression string?
Returns

Task

No documentation is available.

HasCountLessThanOrEqual<T>(int, IEnumerable<T>?, string?, string?)

Assert.Count.cs
public static void HasCountLessThanOrEqual<T>(int expectedCount, IEnumerable<T>? actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
expectedCount int
actual IEnumerable<T>?
message string?
actualExpression string?

No documentation is available.

HasCountLessThanOrEqual<T>(int, ReadOnlySpan<T>, string?, string?)

Assert.Count.cs
public static void HasCountLessThanOrEqual<T>(int expectedCount, ReadOnlySpan<T> actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
expectedCount int
actual ReadOnlySpan<T>
message string?
actualExpression string?

No documentation is available.

HasCountLessThanOrEqual<T>(int, T[]?, string?, string?)

Assert.Count.cs
public static void HasCountLessThanOrEqual<T>(int expectedCount, T[]? actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
expectedCount int
actual T[]?
message string?
actualExpression string?

No documentation is available.

InRange overloads

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

Assert.InRange.cs

Asserts that a value is inside the specified inclusive range.

public static void InRange<T>(T actual, T low, T high, IComparer<T>? comparer = null, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual T
The value to inspect.
low T
The inclusive lower bound.
high T
The inclusive upper bound.
comparer IComparer<T>?
The comparer used to order values.
message string?
actualExpression string?
The expression that produced the actual value.
Remarks

When comparer is null or Comparer<T>.Default, a NaN floating-point value or a null Nullable<T> is never in range, whether it is the value or one of the bounds. This matches low <= actual && actual <= high.

InRange<T>(T, T, T, string?, string?, string?, string?)

Assert.InRange.cs

Asserts that a value of a ref struct type is inside the specified inclusive range, according to IComparable<T>.CompareTo.

public static void InRange<T>(scoped in T actual, scoped in T low, scoped in T high, string? message = null, string? actualExpression = null, string? lowExpression = null, string? highExpression = null) where T : IComparable<T>, allows ref struct
Type parameters
T
Parameters
actual T
The value to inspect.
low T
The inclusive lower bound.
high T
The inclusive upper bound.
message string?
actualExpression string?
The expression that produced the actual value.
lowExpression string?
The expression that produced the lower bound.
highExpression string?
The expression that produced the upper bound.
Remarks

This overload is used only when no other overload applies, such as for a ref struct that implements IComparable<T>. A ref struct value cannot be boxed, so the failure message shows the expressions of the bounds and the type of the values instead of the values.

IsAssignableTo overloads

IsAssignableTo(Type, object?, string?, string?)

Assert.Type.cs

Asserts that an object can be assigned to the specified type.

public static object IsAssignableTo(Type expectedType, object? actual, string? message = null, string? actualExpression = null)
Parameters
expectedType Type
The expected assignable type.
actual object?
The value to inspect.
message string?
actualExpression string?
The expression that produced the actual value.
Returns

object The value.

IsAssignableTo<T>(object?, string?, string?)

Assert.Type.cs

Asserts that an object can be assigned to the specified type.

public static T IsAssignableTo<T>(object? actual, string? message = null, string? actualExpression = null)
Type parameters
T
The expected assignable type.
Parameters
actual object?
The value to inspect.
message string?
actualExpression string?
The expression that produced the actual value.
Returns

T The value cast to T.

IsNotAssignableTo overloads

IsNotAssignableTo(Type, object?, string?, string?)

Assert.NotType.cs
public static void IsNotAssignableTo(Type expectedType, object? actual, string? message = null, string? actualExpression = null)
Parameters
expectedType Type
actual object?
message string?
actualExpression string?

No documentation is available.

IsNotAssignableTo<T>(object?, string?, string?)

Assert.NotType.cs
public static void IsNotAssignableTo<T>(object? actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual object?
message string?
actualExpression string?

No documentation is available.

IsNotType overloads

IsNotType(Type, object?, string?, string?)

Assert.NotType.cs
public static void IsNotType(Type expectedType, object? actual, string? message = null, string? actualExpression = null)
Parameters
expectedType Type
actual object?
message string?
actualExpression string?

No documentation is available.

IsNotType<T>(object?, string?, string?)

Assert.NotType.cs
public static void IsNotType<T>(object? actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual object?
message string?
actualExpression string?

No documentation is available.

IsType overloads

IsType(Type, object?, string?, string?)

Assert.Type.cs

Asserts that an object is exactly of the specified type.

public static object IsType(Type expectedType, object? actual, string? message = null, string? actualExpression = null)
Parameters
expectedType Type
The expected type.
actual object?
The value to inspect.
message string?
actualExpression string?
The expression that produced the actual value.
Returns

object The value.

IsType<T>(object?, string?, string?)

Assert.Type.cs

Asserts that an object is exactly of the specified type.

public static T IsType<T>(object? actual, string? message = null, string? actualExpression = null)
Type parameters
T
The expected type.
Parameters
actual object?
The value to inspect.
message string?
actualExpression string?
The expression that produced the actual value.
Returns

T The value cast to T.

Matches overloads

Matches(string, string, string?, string?, string?)

Assert.Matches.cs

Asserts that the specified regular expression pattern matches the actual value.

public static void Matches(string pattern, string actual, string? message = null, string? actualExpression = null, string? patternExpression = null)
Parameters
pattern string
The regular expression pattern expected to match actual.
actual string
The string to inspect.
message string?
actualExpression string?
The expression that produced the actual value.
patternExpression string?
The expression that produced the pattern.
Remarks

Like Regex.IsMatch, the default match timeout of the application applies (see REGEX_DEFAULT_MATCH_TIMEOUT).

Matches(Regex, string, string?, string?, string?)

Assert.Matches.cs

Asserts that the specified regular expression matches the actual value.

public static void Matches(Regex regex, string actual, string? message = null, string? actualExpression = null, string? regexExpression = null)
Parameters
regex Regex
The regular expression expected to match actual.
actual string
The string to inspect.
message string?
actualExpression string?
The expression that produced the actual value.
regexExpression string?
The expression that produced the regular expression.

NotDistinct overloads

NotDistinct(IEnumerable?, IEqualityComparer?, string?, string?)

Assert.NotDistinct.cs
public static void NotDistinct(IEnumerable? actual, IEqualityComparer? comparer = null, string? message = null, string? actualExpression = null)
Parameters
actual IEnumerable?
comparer IEqualityComparer?
message string?
actualExpression string?

No documentation is available.

NotDistinct(string?, string?, string?)

Assert.NotDistinct.cs
public static void NotDistinct(string? actual, string? message = null, string? actualExpression = null)
Parameters
actual string?
message string?
actualExpression string?

No documentation is available.

NotDistinct<T>(IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?)

Assert.NotDistinct.cs

net10.0

public static Task NotDistinct<T>(IAsyncEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null)

net11.0

public static Task NotDistinct<T>(IAsyncEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual IAsyncEnumerable<T>?
comparer IEqualityComparer<T>?
message string?
actualExpression string?
Returns

Task

No documentation is available.

NotDistinct<T>(IEnumerable<T>?, IEqualityComparer<T>?, string?, string?)

Assert.NotDistinct.cs
public static void NotDistinct<T>(IEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual IEnumerable<T>?
comparer IEqualityComparer<T>?
message string?
actualExpression string?

No documentation is available.

NotDistinct<T>(ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?)

Assert.NotDistinct.cs
public static void NotDistinct<T>(ReadOnlySpan<T> actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual ReadOnlySpan<T>
comparer IEqualityComparer<T>?
message string?
actualExpression string?

No documentation is available.

NotDistinct<T>(T[]?, IEqualityComparer<T>?, string?, string?)

Assert.NotDistinct.cs
public static void NotDistinct<T>(T[]? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual T[]?
comparer IEqualityComparer<T>?
message string?
actualExpression string?

No documentation is available.

NotEmpty overloads

NotEmpty(IEnumerable?, string?, string?)

Assert.NotEmpty.cs
public static void NotEmpty(IEnumerable? actual, string? message = null, string? actualExpression = null)
Parameters
actual IEnumerable?
message string?
actualExpression string?

No documentation is available.

NotEmpty(string?, string?, string?)

Assert.NotEmpty.cs
public static void NotEmpty(string? actual, string? message = null, string? actualExpression = null)
Parameters
actual string?
message string?
actualExpression string?

No documentation is available.

NotEmpty<T>(IAsyncEnumerable<T>?, string?, string?)

Assert.NotEmpty.cs

net10.0

public static Task NotEmpty<T>(IAsyncEnumerable<T>? actual, string? message = null, string? actualExpression = null)

net11.0

public static Task NotEmpty<T>(IAsyncEnumerable<T>? actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual IAsyncEnumerable<T>?
message string?
actualExpression string?
Returns

Task

No documentation is available.

NotEmpty<T>(IEnumerable<T>?, string?, string?)

Assert.NotEmpty.cs
public static void NotEmpty<T>(IEnumerable<T>? actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual IEnumerable<T>?
message string?
actualExpression string?

No documentation is available.

NotEmpty<T>(ReadOnlySpan<T>, string?, string?)

Assert.NotEmpty.cs
public static void NotEmpty<T>(ReadOnlySpan<T> actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual ReadOnlySpan<T>
message string?
actualExpression string?

No documentation is available.

NotEmpty<T>(T[]?, string?, string?)

Assert.NotEmpty.cs
public static void NotEmpty<T>(T[]? actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual T[]?
message string?
actualExpression string?

No documentation is available.

NotEqual overloads

NotEqual(IEnumerable?, IEnumerable?, IEqualityComparer?, string?, string?, string?)

Assert.NotEqual.cs
public static void NotEqual(IEnumerable? expected, IEnumerable? actual, IEqualityComparer? comparer, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected IEnumerable?
actual IEnumerable?
comparer IEqualityComparer?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

NotEqual(IEnumerable?, IEnumerable?, string?, string?, string?)

Assert.NotEqual.cs
public static void NotEqual(IEnumerable? expected, IEnumerable? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected IEnumerable?
actual IEnumerable?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

NotEqual(DateTime, DateTime, TimeSpan, string?, string?, string?)

Assert.NotEqual.cs
public static void NotEqual(DateTime expected, DateTime actual, TimeSpan precision, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected DateTime
actual DateTime
precision TimeSpan
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

NotEqual(DateTimeOffset, DateTimeOffset, TimeSpan, string?, string?, string?)

Assert.NotEqual.cs
public static void NotEqual(DateTimeOffset expected, DateTimeOffset actual, TimeSpan precision, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected DateTimeOffset
actual DateTimeOffset
precision TimeSpan
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

NotEqual(decimal, decimal, decimal, string?, string?, string?)

Assert.NotEqual.cs
public static void NotEqual(decimal expected, decimal actual, decimal tolerance, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected decimal
actual decimal
tolerance decimal
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

NotEqual(decimal, decimal, int, MidpointRounding, string?, string?, string?)

Assert.NotEqual.cs
public static void NotEqual(decimal expected, decimal actual, int precision, MidpointRounding rounding, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected decimal
actual decimal
precision int
rounding MidpointRounding
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

NotEqual(decimal, decimal, int, string?, string?, string?)

Assert.NotEqual.cs
public static void NotEqual(decimal expected, decimal actual, int precision, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected decimal
actual decimal
precision int
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

NotEqual(double, double, double, string?, string?, string?)

Assert.NotEqual.cs
public static void NotEqual(double expected, double actual, double tolerance, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected double
actual double
tolerance double
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

NotEqual(double, double, int, MidpointRounding, string?, string?, string?)

Assert.NotEqual.cs
public static void NotEqual(double expected, double actual, int precision, MidpointRounding rounding, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected double
actual double
precision int
rounding MidpointRounding
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

NotEqual(double, double, int, string?, string?, string?)

Assert.NotEqual.cs
public static void NotEqual(double expected, double actual, int precision, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected double
actual double
precision int
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

NotEqual(Half, Half, Half, string?, string?, string?)

Assert.NotEqual.cs
public static void NotEqual(Half expected, Half actual, Half tolerance, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected Half
actual Half
tolerance Half
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

NotEqual(ReadOnlySpan<char>, ReadOnlySpan<char>, bool, bool, string?, string?, string?)

Assert.NotEqual.cs
public static void NotEqual(ReadOnlySpan<char> expected, ReadOnlySpan<char> actual, bool ignoreCase = false, bool ignoreLineEndingDifferences = false, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected ReadOnlySpan<char>
actual ReadOnlySpan<char>
ignoreCase bool
ignoreLineEndingDifferences bool
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

NotEqual(float, float, int, MidpointRounding, string?, string?, string?)

Assert.NotEqual.cs
public static void NotEqual(float expected, float actual, int precision, MidpointRounding rounding, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected float
actual float
precision int
rounding MidpointRounding
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

NotEqual(float, float, int, string?, string?, string?)

Assert.NotEqual.cs
public static void NotEqual(float expected, float actual, int precision, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected float
actual float
precision int
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

NotEqual(float, float, float, string?, string?, string?)

Assert.NotEqual.cs
public static void NotEqual(float expected, float actual, float tolerance, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected float
actual float
tolerance float
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

NotEqual(string?, string?, bool, bool, string?, string?, string?)

Assert.NotEqual.cs
public static void NotEqual(string? expected, string? actual, bool ignoreCase = false, bool ignoreLineEndingDifferences = false, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected string?
actual string?
ignoreCase bool
ignoreLineEndingDifferences bool
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

NotEqual<T>(IAsyncEnumerable<T>?, IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)

Assert.NotEqual.cs

net10.0

public static Task NotEqual<T>(IAsyncEnumerable<T>? expected, IAsyncEnumerable<T>? actual, IEqualityComparer<T>? comparer, string? message = null, string? actualExpression = null, string? expectedExpression = null)

net11.0

public static Task NotEqual<T>(IAsyncEnumerable<T>? expected, IAsyncEnumerable<T>? actual, IEqualityComparer<T>? comparer, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected IAsyncEnumerable<T>?
actual IAsyncEnumerable<T>?
comparer IEqualityComparer<T>?
message string?
actualExpression string?
expectedExpression string?
Returns

Task

No documentation is available.

NotEqual<T>(IAsyncEnumerable<T>?, IAsyncEnumerable<T>?, string?, string?, string?)

Assert.NotEqual.cs

net10.0

public static Task NotEqual<T>(IAsyncEnumerable<T>? expected, IAsyncEnumerable<T>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)

net11.0

public static Task NotEqual<T>(IAsyncEnumerable<T>? expected, IAsyncEnumerable<T>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected IAsyncEnumerable<T>?
actual IAsyncEnumerable<T>?
message string?
actualExpression string?
expectedExpression string?
Returns

Task

No documentation is available.

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

Assert.NotEqual.cs
public static void NotEqual<T>(IEnumerable<T>? expected, IEnumerable<T>? actual, IEqualityComparer<T>? comparer, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected IEnumerable<T>?
actual IEnumerable<T>?
comparer IEqualityComparer<T>?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

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

Assert.NotEqual.cs
public static void NotEqual<T>(IEnumerable<T>? expected, IEnumerable<T>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected IEnumerable<T>?
actual IEnumerable<T>?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

NotEqual<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, string?, string?, string?)

Assert.NotEqual.cs
public static void NotEqual<T>(ReadOnlySpan<T> expected, ReadOnlySpan<T> actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected ReadOnlySpan<T>
actual ReadOnlySpan<T>
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

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

Assert.NotEqual.cs

Verifies that two values are not equal according to comparer.

public static void NotEqual<T>(T expected, T actual, IEqualityComparer<T>? comparer, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected T
actual T
comparer IEqualityComparer<T>?
message string?
actualExpression string?
expectedExpression string?
Remarks

When comparer is null, the values are compared the way Assert.NotEqual(expected, actual) compares them.

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

Assert.NotEqual.cs
public static void NotEqual<T>(T expected, T? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected T
actual T?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

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

Assert.NotEqual.cs
public static void NotEqual<T>(T expected, T actual, T tolerance, string? message = null, string? actualExpression = null, string? expectedExpression = null) where T : IFloatingPoint<T>
Type parameters
T
Parameters
expected T
actual T
tolerance T
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

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

Assert.NotEqual.cs

Verifies that two values of a ref struct type are not equal according to IEquatable<T>.Equals.

public static void NotEqual<T>(scoped in T expected, scoped in T actual, string? message = null, string? actualExpression = null, string? expectedExpression = null) where T : IEquatable<T>, allows ref struct
Type parameters
T
Parameters
expected T
actual T
message string?
actualExpression string?
expectedExpression string?
Remarks

This overload is used only when no other overload applies, such as for a ref struct that implements IEquatable<T>. A ref struct value cannot be boxed, so the failure message shows the type of the values instead of the values.

NotEqual<TExpected, TActual>(IAsyncEnumerable<TExpected>?, IAsyncEnumerable<TActual>?, string?, string?, string?)

Assert.NotEqual.cs

net10.0

public static Task NotEqual<TExpected, TActual>(IAsyncEnumerable<TExpected>? expected, IAsyncEnumerable<TActual>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)

net11.0

public static Task NotEqual<TExpected, TActual>(IAsyncEnumerable<TExpected>? expected, IAsyncEnumerable<TActual>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
TExpected
TActual
Parameters
expected IAsyncEnumerable<TExpected>?
actual IAsyncEnumerable<TActual>?
message string?
actualExpression string?
expectedExpression string?
Returns

Task

No documentation is available.

NotEqual<TExpected, TActual>(IEnumerable<TExpected>?, IEnumerable<TActual>?, string?, string?, string?)

Assert.NotEqual.cs
public static void NotEqual<TExpected, TActual>(IEnumerable<TExpected>? expected, IEnumerable<TActual>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
TExpected
TActual
Parameters
expected IEnumerable<TExpected>?
actual IEnumerable<TActual>?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

NotEqual<TExpected, TActual>(ReadOnlyMemory<TExpected>, ReadOnlyMemory<TActual>, string?, string?, string?)

Assert.NotEqual.cs
public static void NotEqual<TExpected, TActual>(ReadOnlyMemory<TExpected> expected, ReadOnlyMemory<TActual> actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
TExpected
TActual
Parameters
expected ReadOnlyMemory<TExpected>
actual ReadOnlyMemory<TActual>
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

NotEqual<TExpected, TActual>(ReadOnlySpan<TExpected>, ReadOnlySpan<TActual>, string?, string?, string?)

Assert.NotEqual.cs
public static void NotEqual<TExpected, TActual>(ReadOnlySpan<TExpected> expected, ReadOnlySpan<TActual> actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
TExpected
TActual
Parameters
expected ReadOnlySpan<TExpected>
actual ReadOnlySpan<TActual>
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

NotEqual<TExpected, TActual>(TExpected, TActual?, string?, string?, string?)

Assert.NotEqual.cs
public static void NotEqual<TExpected, TActual>(TExpected expected, TActual? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
TExpected
TActual
Parameters
expected TExpected
actual TActual?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

NotEqualUnordered overloads

NotEqualUnordered(IEnumerable?, IEnumerable?, IEqualityComparer?, string?, string?, string?)

Assert.NotEqualUnordered.cs
public static void NotEqualUnordered(IEnumerable? expected, IEnumerable? actual, IEqualityComparer? comparer, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected IEnumerable?
actual IEnumerable?
comparer IEqualityComparer?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

NotEqualUnordered(IEnumerable?, IEnumerable?, string?, string?, string?)

Assert.NotEqualUnordered.cs
public static void NotEqualUnordered(IEnumerable? expected, IEnumerable? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected IEnumerable?
actual IEnumerable?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

NotEqualUnordered<T>(IAsyncEnumerable<T>?, IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)

Assert.NotEqualUnordered.cs

Asserts that two sequences do not contain the same items, regardless of their order.

net10.0

public static Task NotEqualUnordered<T>(IAsyncEnumerable<T>? expected, IAsyncEnumerable<T>? actual, IEqualityComparer<T>? comparer, string? message = null, string? actualExpression = null, string? expectedExpression = null)

net11.0

public static Task NotEqualUnordered<T>(IAsyncEnumerable<T>? expected, IAsyncEnumerable<T>? actual, IEqualityComparer<T>? comparer, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected IAsyncEnumerable<T>?
actual IAsyncEnumerable<T>?
comparer IEqualityComparer<T>?
The comparer used to compare items. When null, items are compared like Assert.Equal compares two values.
message string?
actualExpression string?
expectedExpression string?
Returns

Task

NotEqualUnordered<T>(IAsyncEnumerable<T>?, IAsyncEnumerable<T>?, string?, string?, string?)

Assert.NotEqualUnordered.cs

Asserts that two sequences do not contain the same items, regardless of their order.

net10.0

public static Task NotEqualUnordered<T>(IAsyncEnumerable<T>? expected, IAsyncEnumerable<T>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)

net11.0

public static Task NotEqualUnordered<T>(IAsyncEnumerable<T>? expected, IAsyncEnumerable<T>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected IAsyncEnumerable<T>?
actual IAsyncEnumerable<T>?
message string?
actualExpression string?
expectedExpression string?
Returns

Task

Remarks

This assertion is the exact complement of EqualUnordered: two null sequences are equal, and a null sequence differs from any other sequence.

NotEqualUnordered<T>(IEnumerable<T>?, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)

Assert.NotEqualUnordered.cs

Asserts that two sequences do not contain the same items, regardless of their order.

public static void NotEqualUnordered<T>(IEnumerable<T>? expected, IEnumerable<T>? actual, IEqualityComparer<T>? comparer, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected IEnumerable<T>?
actual IEnumerable<T>?
comparer IEqualityComparer<T>?
The comparer used to compare items. When null, items are compared like Assert.Equal compares two values.
message string?
actualExpression string?
expectedExpression string?

NotEqualUnordered<T>(IEnumerable<T>?, IEnumerable<T>?, string?, string?, string?)

Assert.NotEqualUnordered.cs

Asserts that two sequences do not contain the same items, regardless of their order.

public static void NotEqualUnordered<T>(IEnumerable<T>? expected, IEnumerable<T>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected IEnumerable<T>?
actual IEnumerable<T>?
message string?
actualExpression string?
expectedExpression string?
Remarks

This assertion is the exact complement of EqualUnordered: two null sequences are equal, and a null sequence differs from any other sequence.

NotEqualUnordered<TExpected, TActual>(IAsyncEnumerable<TExpected>?, IAsyncEnumerable<TActual>?, string?, string?, string?)

Assert.NotEqualUnordered.cs

net10.0

public static Task NotEqualUnordered<TExpected, TActual>(IAsyncEnumerable<TExpected>? expected, IAsyncEnumerable<TActual>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)

net11.0

public static Task NotEqualUnordered<TExpected, TActual>(IAsyncEnumerable<TExpected>? expected, IAsyncEnumerable<TActual>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
TExpected
TActual
Parameters
expected IAsyncEnumerable<TExpected>?
actual IAsyncEnumerable<TActual>?
message string?
actualExpression string?
expectedExpression string?
Returns

Task

No documentation is available.

NotEqualUnordered<TExpected, TActual>(IEnumerable<TExpected>?, IEnumerable<TActual>?, string?, string?, string?)

Assert.NotEqualUnordered.cs
public static void NotEqualUnordered<TExpected, TActual>(IEnumerable<TExpected>? expected, IEnumerable<TActual>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
TExpected
TActual
Parameters
expected IEnumerable<TExpected>?
actual IEnumerable<TActual>?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

NotEquivalent overloads

NotEquivalent(object?, object?, EquivalentOptions?, string?, string?, string?)

Assert.NotEquivalent.cs
public static void NotEquivalent(object? expected, object? actual, EquivalentOptions? options, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected object?
actual object?
options EquivalentOptions?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

NotEquivalent(object?, object?, string?, string?, string?)

Assert.NotEquivalent.cs
public static void NotEquivalent(object? expected, object? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected object?
actual object?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

NotInRange overloads

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

Assert.NotInRange.cs
public static void NotInRange<T>(T actual, T low, T high, IComparer<T>? comparer = null, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual T
low T
high T
comparer IComparer<T>?
message string?
actualExpression string?

No documentation is available.

NotInRange<T>(T, T, T, string?, string?, string?, string?)

Assert.NotInRange.cs

Asserts that a value of a ref struct type is outside the specified inclusive range, according to IComparable<T>.CompareTo.

public static void NotInRange<T>(scoped in T actual, scoped in T low, scoped in T high, string? message = null, string? actualExpression = null, string? lowExpression = null, string? highExpression = null) where T : IComparable<T>, allows ref struct
Type parameters
T
Parameters
actual T
The value to inspect.
low T
The inclusive lower bound.
high T
The inclusive upper bound.
message string?
actualExpression string?
The expression that produced the actual value.
lowExpression string?
The expression that produced the lower bound.
highExpression string?
The expression that produced the upper bound.
Remarks

This overload is used only when no other overload applies, such as for a ref struct that implements IComparable<T>. A ref struct value cannot be boxed, so the failure message shows the expressions of the bounds and the type of the values instead of the values.

NotNull overloads

NotNull(object?, string?, string?)

Assert.NotNull.cs

Asserts that a value is not null.

public static object NotNull(object? actual, string? message = null, string? actualExpression = null)
Parameters
actual object?
The value to inspect.
message string?
actualExpression string?
The expression that produced the actual value.
Returns

object The value.

Remarks

This overload only binds when neither generic overload applies, such as for a value of an unconstrained type parameter or the null literal.

NotNull<T>(T?, string?, string?)

Assert.NotNull.cs
public static T NotNull<T>(T? actual, string? message = null, string? actualExpression = null) where T : struct
Type parameters
T
Parameters
actual T?
message string?
actualExpression string?
Returns

T

No documentation is available.

NotNull<T>(T?, string?, string?)

Assert.NotNull.cs

Asserts that a reference is not null.

public static T NotNull<T>(T? actual, string? message = null, string? actualExpression = null) where T : class
Type parameters
T
The type of the value.
Parameters
actual T?
The value to inspect.
message string?
actualExpression string?
The expression that produced the actual value.
Returns

T The value, typed as non-nullable.

NotProperSubset overloads

NotProperSubset(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)

Assert.NotSet.cs

Asserts that actual is not a proper subset of expectedSuperset. This is the exact complement of ProperSubset, so a null actual succeeds.

public static void NotProperSubset(IEnumerable expectedSuperset, IEnumerable? actual, IEqualityComparer? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expectedSuperset IEnumerable
The collection actual is compared to.
actual IEnumerable?
The collection expected not to be a proper subset of expectedSuperset.
comparer IEqualityComparer?
The comparer used to compare values. When null and actual is a set, the set compares values itself, like ISet<T>.IsProperSubsetOf; otherwise EqualityComparer<T>.Default is used.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected superset.

NotProperSubset<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)

Assert.NotSet.cs

Asserts that actual is not a proper subset of expectedSuperset. This is the exact complement of ProperSubset, so a null actual succeeds.

public static void NotProperSubset<T>(IEnumerable<T> expectedSuperset, IEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expectedSuperset IEnumerable<T>
The collection actual is compared to.
actual IEnumerable<T>?
The collection expected not to be a proper subset of expectedSuperset.
comparer IEqualityComparer<T>?
The comparer used to compare values. When null and actual is a set, the set compares values itself, like ISet<T>.IsProperSubsetOf; otherwise EqualityComparer<T>.Default is used.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected superset.

NotProperSuperset overloads

NotProperSuperset(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)

Assert.NotSet.cs

Asserts that actual is not a proper superset of expectedSubset. This is the exact complement of ProperSuperset, so a null actual succeeds.

public static void NotProperSuperset(IEnumerable expectedSubset, IEnumerable? actual, IEqualityComparer? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expectedSubset IEnumerable
The collection actual is compared to.
actual IEnumerable?
The collection expected not to be a proper superset of expectedSubset.
comparer IEqualityComparer?
The comparer used to compare values. When null and actual is a set, the set compares values itself, like ISet<T>.IsProperSupersetOf; otherwise EqualityComparer<T>.Default is used.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected subset.

NotProperSuperset<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)

Assert.NotSet.cs

Asserts that actual is not a proper superset of expectedSubset. This is the exact complement of ProperSuperset, so a null actual succeeds.

public static void NotProperSuperset<T>(IEnumerable<T> expectedSubset, IEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expectedSubset IEnumerable<T>
The collection actual is compared to.
actual IEnumerable<T>?
The collection expected not to be a proper superset of expectedSubset.
comparer IEqualityComparer<T>?
The comparer used to compare values. When null and actual is a set, the set compares values itself, like ISet<T>.IsProperSupersetOf; otherwise EqualityComparer<T>.Default is used.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected subset.

NotRaisedAny<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Action, string?, string?)

Assert.DoesNotRaise.cs

Compatibility shim for xUnit. Asserts that no event is raised.

public static void NotRaisedAny<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Action action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgs

Type parameters

TEventArgs

Parameters

attach Action<EventHandler<TEventArgs>>
detach Action<EventHandler<TEventArgs>>
action Action
message string?
actionExpression string?

NotRaisedAnyAsync<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<Task>, string?, string?)

Assert.DoesNotRaise.cs

Compatibility shim for xUnit. Asserts that no event is raised by the asynchronous action.

net10.0

public static Task NotRaisedAnyAsync<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Func<Task> action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgs

net11.0

public static Task NotRaisedAnyAsync<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Func<Task> action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgs

Type parameters

TEventArgs

Parameters

attach Action<EventHandler<TEventArgs>>
detach Action<EventHandler<TEventArgs>>
action Func<Task>
message string?
actionExpression string?

Returns

Task

NotSame(object?, object?, string?, string?, string?)

Assert.NotSame.cs
public static void NotSame(object? expected, object? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)

Parameters

expected object?
actual object?
message string?
actualExpression string?
expectedExpression string?

No documentation is available.

Null overloads

Null(object?, string?, string?)

Assert.Null.cs

Asserts that an object is null.

public static void Null(object? actual, string? message = null, string? actualExpression = null)
Parameters
actual object?
The value to inspect.
message string?
actualExpression string?
The expression that produced the actual value.

Null<T>(T?, string?, string?)

Assert.Null.cs
public static void Null<T>(T? actual, string? message = null, string? actualExpression = null) where T : struct
Type parameters
T
Parameters
actual T?
message string?
actualExpression string?

No documentation is available.

ProperSubset overloads

ProperSubset(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)

Assert.Set.cs

Asserts that actual is a proper subset of expectedSuperset.

public static void ProperSubset(IEnumerable expectedSuperset, IEnumerable? actual, IEqualityComparer? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expectedSuperset IEnumerable
The collection expected to contain every unique item in actual and at least one additional unique item.
actual IEnumerable?
The collection expected to be a proper subset of expectedSuperset.
comparer IEqualityComparer?
The comparer used to compare values.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected superset.

ProperSubset<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)

Assert.Set.cs

Asserts that actual is a proper subset of expectedSuperset, like actual.IsProperSubsetOf(expectedSuperset).

public static void ProperSubset<T>(IEnumerable<T> expectedSuperset, IEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expectedSuperset IEnumerable<T>
The collection expected to contain every unique item in actual and at least one additional unique item.
actual IEnumerable<T>?
The collection expected to be a proper subset of expectedSuperset.
comparer IEqualityComparer<T>?
The comparer used to compare values. When null and actual is a set, the set compares values itself, like ISet<T>.IsProperSubsetOf; otherwise EqualityComparer<T>.Default is used.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected superset.

ProperSuperset overloads

ProperSuperset(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)

Assert.Set.cs

Asserts that actual is a proper superset of expectedSubset.

public static void ProperSuperset(IEnumerable expectedSubset, IEnumerable? actual, IEqualityComparer? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expectedSubset IEnumerable
The collection whose unique items are all expected in actual, with at least one fewer unique item.
actual IEnumerable?
The collection expected to be a proper superset of expectedSubset.
comparer IEqualityComparer?
The comparer used to compare values.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected subset.

ProperSuperset<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)

Assert.Set.cs

Asserts that actual is a proper superset of expectedSubset, like actual.IsProperSupersetOf(expectedSubset).

public static void ProperSuperset<T>(IEnumerable<T> expectedSubset, IEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expectedSubset IEnumerable<T>
The collection whose unique items are all expected in actual, with at least one fewer unique item.
actual IEnumerable<T>?
The collection expected to be a proper superset of expectedSubset.
comparer IEqualityComparer<T>?
The comparer used to compare values. When null and actual is a set, the set compares values itself, like ISet<T>.IsProperSupersetOf; otherwise EqualityComparer<T>.Default is used.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected subset.

Raise overloads

Raise(Action<EventHandler>, Action<EventHandler>, Action, string?, string?)

Assert.Raise.cs
public static RaisedEvent<EventArgs> Raise(Action<EventHandler> attach, Action<EventHandler> detach, Action action, string? message = null, string? actionExpression = null)
Parameters
attach Action<EventHandler>
detach Action<EventHandler>
action Action
message string?
actionExpression string?
Returns

RaisedEvent<EventArgs>

No documentation is available.

Raise(Action<EventHandler>, Action<EventHandler>, Func<Task>, string?, string?)

Assert.Raise.cs

net10.0

public static Task<RaisedEvent<EventArgs>> Raise(Action<EventHandler> attach, Action<EventHandler> detach, Func<Task> action, string? message = null, string? actionExpression = null)

net11.0

public static Task<RaisedEvent<EventArgs>> Raise(Action<EventHandler> attach, Action<EventHandler> detach, Func<Task> action, string? message = null, string? actionExpression = null)
Parameters
attach Action<EventHandler>
detach Action<EventHandler>
action Func<Task>
message string?
actionExpression string?
Returns

Task<RaisedEvent<EventArgs>>

No documentation is available.

Raise(Action<EventHandler>, Action<EventHandler>, Func<ValueTask>, string?, string?)

Assert.Raise.cs

net10.0

public static Task<RaisedEvent<EventArgs>> Raise(Action<EventHandler> attach, Action<EventHandler> detach, Func<ValueTask> action, string? message = null, string? actionExpression = null)

net11.0

public static Task<RaisedEvent<EventArgs>> Raise(Action<EventHandler> attach, Action<EventHandler> detach, Func<ValueTask> action, string? message = null, string? actionExpression = null)

No documentation is available.

Raise<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Action, string?, string?)

Assert.Raise.cs
public static RaisedEvent<TEventArgs> Raise<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Action action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgs
Type parameters
TEventArgs
Parameters
attach Action<EventHandler<TEventArgs>>
detach Action<EventHandler<TEventArgs>>
action Action
message string?
actionExpression string?
Returns

RaisedEvent<TEventArgs>

No documentation is available.

Raise<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<Task>, string?, string?)

Assert.Raise.cs

net10.0

public static Task<RaisedEvent<TEventArgs>> Raise<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Func<Task> action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgs

net11.0

public static Task<RaisedEvent<TEventArgs>> Raise<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Func<Task> action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgs
Type parameters
TEventArgs
Parameters
attach Action<EventHandler<TEventArgs>>
detach Action<EventHandler<TEventArgs>>
action Func<Task>
message string?
actionExpression string?
Returns

Task<RaisedEvent<TEventArgs>>

No documentation is available.

Raise<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<ValueTask>, string?, string?)

Assert.Raise.cs

net10.0

public static Task<RaisedEvent<TEventArgs>> Raise<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Func<ValueTask> action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgs

net11.0

public static Task<RaisedEvent<TEventArgs>> Raise<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Func<ValueTask> action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgs
Type parameters
TEventArgs
Parameters
attach Action<EventHandler<TEventArgs>>
detach Action<EventHandler<TEventArgs>>
action Func<ValueTask>
message string?
actionExpression string?
Returns

Task<RaisedEvent<TEventArgs>>

No documentation is available.

RaiseAny overloads

RaiseAny(Action<EventHandler>, Action<EventHandler>, Action, string?, string?)

Assert.Raise.cs
public static RaisedEvent<EventArgs> RaiseAny(Action<EventHandler> attach, Action<EventHandler> detach, Action action, string? message = null, string? actionExpression = null)
Parameters
attach Action<EventHandler>
detach Action<EventHandler>
action Action
message string?
actionExpression string?
Returns

RaisedEvent<EventArgs>

No documentation is available.

RaiseAny(Action<EventHandler>, Action<EventHandler>, Func<Task>, string?, string?)

Assert.Raise.cs

net10.0

public static Task<RaisedEvent<EventArgs>> RaiseAny(Action<EventHandler> attach, Action<EventHandler> detach, Func<Task> action, string? message = null, string? actionExpression = null)

net11.0

public static Task<RaisedEvent<EventArgs>> RaiseAny(Action<EventHandler> attach, Action<EventHandler> detach, Func<Task> action, string? message = null, string? actionExpression = null)
Parameters
attach Action<EventHandler>
detach Action<EventHandler>
action Func<Task>
message string?
actionExpression string?
Returns

Task<RaisedEvent<EventArgs>>

No documentation is available.

RaiseAny(Action<EventHandler>, Action<EventHandler>, Func<ValueTask>, string?, string?)

Assert.Raise.cs

net10.0

public static Task<RaisedEvent<EventArgs>> RaiseAny(Action<EventHandler> attach, Action<EventHandler> detach, Func<ValueTask> action, string? message = null, string? actionExpression = null)

net11.0

public static Task<RaisedEvent<EventArgs>> RaiseAny(Action<EventHandler> attach, Action<EventHandler> detach, Func<ValueTask> action, string? message = null, string? actionExpression = null)

No documentation is available.

RaiseAny<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Action, string?, string?)

Assert.Raise.cs
public static RaisedEvent<TEventArgs> RaiseAny<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Action action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgs
Type parameters
TEventArgs
Parameters
attach Action<EventHandler<TEventArgs>>
detach Action<EventHandler<TEventArgs>>
action Action
message string?
actionExpression string?
Returns

RaisedEvent<TEventArgs>

No documentation is available.

RaiseAny<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<Task>, string?, string?)

Assert.Raise.cs

net10.0

public static Task<RaisedEvent<TEventArgs>> RaiseAny<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Func<Task> action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgs

net11.0

public static Task<RaisedEvent<TEventArgs>> RaiseAny<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Func<Task> action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgs
Type parameters
TEventArgs
Parameters
attach Action<EventHandler<TEventArgs>>
detach Action<EventHandler<TEventArgs>>
action Func<Task>
message string?
actionExpression string?
Returns

Task<RaisedEvent<TEventArgs>>

No documentation is available.

RaiseAny<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<ValueTask>, string?, string?)

Assert.Raise.cs

net10.0

public static Task<RaisedEvent<TEventArgs>> RaiseAny<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Func<ValueTask> action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgs

net11.0

public static Task<RaisedEvent<TEventArgs>> RaiseAny<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Func<ValueTask> action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgs
Type parameters
TEventArgs
Parameters
attach Action<EventHandler<TEventArgs>>
detach Action<EventHandler<TEventArgs>>
action Func<ValueTask>
message string?
actionExpression string?
Returns

Task<RaisedEvent<TEventArgs>>

No documentation is available.

Raises<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Action, string?, string?)

Assert.Raise.cs

Compatibility shim for xUnit. Asserts that an event with exactly the specified event args type is raised.

public static RaisedEvent<TEventArgs> Raises<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Action action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgs

Type parameters

TEventArgs

Parameters

attach Action<EventHandler<TEventArgs>>
detach Action<EventHandler<TEventArgs>>
action Action
message string?
actionExpression string?

Returns

RaisedEvent<TEventArgs>

RaisesAny overloads

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

Assert.Raise.cs

Compatibility shim for xUnit. Asserts that an event is raised.

public static RaisedEvent<EventArgs> RaisesAny(Action<EventHandler> attach, Action<EventHandler> detach, Action action, string? message = null, string? actionExpression = null)
Parameters
attach Action<EventHandler>
detach Action<EventHandler>
action Action
message string?
actionExpression string?
Returns

RaisedEvent<EventArgs>

RaisesAny<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Action, string?, string?)

Assert.Raise.cs

Compatibility shim for xUnit. Asserts that an event with an event args type assignable to the specified type is raised.

public static RaisedEvent<TEventArgs> RaisesAny<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Action action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgs
Type parameters
TEventArgs
Parameters
attach Action<EventHandler<TEventArgs>>
detach Action<EventHandler<TEventArgs>>
action Action
message string?
actionExpression string?
Returns

RaisedEvent<TEventArgs>

RaisesAnyAsync overloads

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

Assert.Raise.cs

Compatibility shim for xUnit. Asserts that an event is raised by the asynchronous action.

net10.0

public static Task<RaisedEvent<EventArgs>> RaisesAnyAsync(Action<EventHandler> attach, Action<EventHandler> detach, Func<Task> action, string? message = null, string? actionExpression = null)

net11.0

public static Task<RaisedEvent<EventArgs>> RaisesAnyAsync(Action<EventHandler> attach, Action<EventHandler> detach, Func<Task> action, string? message = null, string? actionExpression = null)
Parameters
attach Action<EventHandler>
detach Action<EventHandler>
action Func<Task>
message string?
actionExpression string?
Returns

Task<RaisedEvent<EventArgs>>

RaisesAnyAsync<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<Task>, string?, string?)

Assert.Raise.cs

Compatibility shim for xUnit. Asserts that an event with an event args type assignable to the specified type is raised by the asynchronous action.

net10.0

public static Task<RaisedEvent<TEventArgs>> RaisesAnyAsync<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Func<Task> action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgs

net11.0

public static Task<RaisedEvent<TEventArgs>> RaisesAnyAsync<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Func<Task> action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgs
Type parameters
TEventArgs
Parameters
attach Action<EventHandler<TEventArgs>>
detach Action<EventHandler<TEventArgs>>
action Func<Task>
message string?
actionExpression string?
Returns

Task<RaisedEvent<TEventArgs>>

RaisesAsync<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<Task>, string?, string?)

Assert.Raise.cs

Compatibility shim for xUnit. Asserts that an event with exactly the specified event args type is raised by the asynchronous action.

net10.0

public static Task<RaisedEvent<TEventArgs>> RaisesAsync<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Func<Task> action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgs

net11.0

public static Task<RaisedEvent<TEventArgs>> RaisesAsync<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Func<Task> action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgs

Type parameters

TEventArgs

Parameters

attach Action<EventHandler<TEventArgs>>
detach Action<EventHandler<TEventArgs>>
action Func<Task>
message string?
actionExpression string?

Returns

Task<RaisedEvent<TEventArgs>>

ReferenceEquals(object?, object?)

Assert.cs
  • Obsolete: This is an override of Object.ReferenceEquals(). Use Assert.Same() instead.
[Obsolete("This is an override of Object.ReferenceEquals(). Use Assert.Same() instead.", true)]
public new static bool ReferenceEquals(object? a, object? b)

Parameters

a object?
b object?

Returns

bool

No documentation is available.

Same(object?, object?, string?, string?, string?)

Assert.Same.cs

Asserts that two objects refer to the same instance.

public static void Same(object? expected, object? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)

Parameters

expected object?
The expected object instance.
actual object?
The actual object instance.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

Single overloads

Single(IEnumerable?, string?, string?)

Assert.Single.cs

Asserts that a non-generic enumerable contains a single item and returns it.

public static object? Single(IEnumerable? actual, string? message = null, string? actualExpression = null)
Parameters
actual IEnumerable?
The enumerable to inspect.
message string?
actualExpression string?
The expression that produced the actual value.
Returns

object?

Single(ReadOnlySpan<char>, string?, string?)

Assert.Single.cs

Asserts that a character span contains a single character and returns it.

public static char Single(ReadOnlySpan<char> actual, string? message = null, string? actualExpression = null)
Parameters
actual ReadOnlySpan<char>
The span to inspect.
message string?
actualExpression string?
The expression that produced the actual value.
Returns

char

Single(string?, string?, string?)

Assert.Single.cs

Asserts that a string contains a single character and returns it.

public static char Single(string? actual, string? message = null, string? actualExpression = null)
Parameters
actual string?
The string to inspect.
message string?
actualExpression string?
The expression that produced the actual value.
Returns

char

Single<T>(IAsyncEnumerable<T>?, string?, string?)

Assert.Single.cs

Asserts that an asynchronous sequence contains a single item and returns it.

net10.0

public static Task<T> Single<T>(IAsyncEnumerable<T>? actual, string? message = null, string? actualExpression = null)

net11.0

public static Task<T> Single<T>(IAsyncEnumerable<T>? actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual IAsyncEnumerable<T>?
The sequence to inspect.
message string?
actualExpression string?
The expression that produced the actual value.
Returns

Task<T>

Single<T>(IEnumerable<T>?, Func<T, bool>, string?, string?, string?)

Assert.Single.cs

Asserts that an enumerable contains a single item matching the predicate and returns it.

public static T Single<T>(IEnumerable<T>? actual, Func<T, bool> predicate, string? message = null, string? actualExpression = null, string? predicateExpression = null)
Type parameters
T
Parameters
actual IEnumerable<T>?
The enumerable to inspect.
predicate Func<T, bool>
The predicate used to select matching items.
message string?
actualExpression string?
The expression that produced the actual value.
predicateExpression string?
The expression that produced the predicate.
Returns

T

Single<T>(IEnumerable<T>?, string?, string?)

Assert.Single.cs

Asserts that an enumerable contains a single item and returns it.

public static T Single<T>(IEnumerable<T>? actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual IEnumerable<T>?
The enumerable to inspect.
message string?
actualExpression string?
The expression that produced the actual value.
Returns

T

Single<T>(ReadOnlySpan<T>, string?, string?)

Assert.Single.cs

Asserts that a span contains a single item and returns it.

public static T Single<T>(ReadOnlySpan<T> actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual ReadOnlySpan<T>
The span to inspect.
message string?
actualExpression string?
The expression that produced the actual value.
Returns

T

Single<T>(T[]?, string?, string?)

Assert.Single.cs

Asserts that an array is not null, contains a single item and returns it.

public static T Single<T>(T[]? actual, string? message = null, string? actualExpression = null)
Type parameters
T
Parameters
actual T[]?
The array to inspect.
message string?
actualExpression string?
The expression that produced the actual value.
Returns

T

Remarks

Arrays would otherwise bind to the ReadOnlySpan<T> overload, which turns a null array into an empty span.

StartsWith overloads

StartsWith(char, string?, IEqualityComparer<char>?, string?, string?, string?)

Assert.StartsWith.cs

Asserts that a string starts with the specified character.

public static void StartsWith(char expected, string? actual, IEqualityComparer<char>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected char
The character expected at the start of actual.
actual string?
The string to inspect.
comparer IEqualityComparer<char>?
The comparer used to compare characters.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

StartsWith(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)

Assert.StartsWith.cs

Asserts that a non-generic enumerable starts with the specified non-generic prefix.

public static void StartsWith(IEnumerable expected, IEnumerable? actual, IEqualityComparer? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected IEnumerable
The prefix expected at the start of actual. Without comparer, the assertion also succeeds when expected is itself the first item of actual. A string is compared as an item, unless actual is a sequence of characters.
actual IEnumerable?
The enumerable to inspect.
comparer IEqualityComparer?
The comparer used to compare values.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

StartsWith(object?, IEnumerable?, string?, string?, string?)

Assert.StartsWith.cs

Asserts that a non-generic enumerable starts with the specified value.

public static void StartsWith(object? expected, IEnumerable? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected object?
The value expected at the start of actual. A string compared to a sequence of characters is compared as a prefix.
actual IEnumerable?
The enumerable to inspect.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

StartsWith(ReadOnlySpan<char>, ReadOnlySpan<char>, bool, string?, string?, string?)

Assert.StartsWith.cs

Asserts that a character span starts with the specified prefix.

public static void StartsWith(ReadOnlySpan<char> expected, ReadOnlySpan<char> actual, bool ignoreCase = false, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected ReadOnlySpan<char>
The prefix expected at the start of actual.
actual ReadOnlySpan<char>
The span to inspect.
ignoreCase bool
When true, the comparison ignores casing (OrdinalIgnoreCase); otherwise, it is case-sensitive (Ordinal).
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

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

Assert.StartsWith.cs

Asserts that a character span starts with the specified prefix.

public static void StartsWith(ReadOnlySpan<char> expected, ReadOnlySpan<char> actual, StringComparison comparisonType, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected ReadOnlySpan<char>
The prefix expected at the start of actual.
actual ReadOnlySpan<char>
The span to inspect.
comparisonType StringComparison
The comparison used to compare expected with the start of actual.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

StartsWith(string, string?, bool, string?, string?, string?)

Assert.StartsWith.cs

Asserts that a string starts with the specified prefix.

public static void StartsWith(string expected, string? actual, bool ignoreCase = false, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected string
The prefix expected at the start of actual.
actual string?
The string to inspect.
ignoreCase bool
When true, the comparison ignores casing (OrdinalIgnoreCase); otherwise, it is case-sensitive (Ordinal).
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

StartsWith(string, string?, StringComparison, string?, string?, string?)

Assert.StartsWith.cs

Asserts that a string starts with the specified prefix.

public static void StartsWith(string expected, string? actual, StringComparison comparisonType, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expected string
The prefix expected at the start of actual.
actual string?
The string to inspect.
comparisonType StringComparison
The comparison used to compare expected with the start of actual.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

StartsWith<T>(IEnumerable<T>, IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)

Assert.StartsWith.cs

Asserts that an asynchronous sequence starts with the specified prefix.

net10.0

public static Task StartsWith<T>(IEnumerable<T> expected, IAsyncEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)

net11.0

public static Task StartsWith<T>(IEnumerable<T> expected, IAsyncEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected IEnumerable<T>
The prefix expected at the start of actual. When expected is itself the first item of actual, the assertion also succeeds.
actual IAsyncEnumerable<T>?
The sequence to inspect.
comparer IEqualityComparer<T>?
The comparer used to compare values.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.
Returns

Task

StartsWith<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)

Assert.StartsWith.cs

Asserts that an enumerable starts with the specified prefix.

public static void StartsWith<T>(IEnumerable<T> expected, IEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected IEnumerable<T>
The prefix expected at the start of actual. When expected is itself the first item of actual, the assertion also succeeds.
actual IEnumerable<T>?
The enumerable to inspect.
comparer IEqualityComparer<T>?
The comparer used to compare values.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

StartsWith<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)

Assert.StartsWith.cs

Asserts that a span starts with the specified prefix.

public static void StartsWith<T>(ReadOnlySpan<T> expected, ReadOnlySpan<T> actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected ReadOnlySpan<T>
The prefix expected at the start of actual.
actual ReadOnlySpan<T>
The span to inspect.
comparer IEqualityComparer<T>?
The comparer used to compare values.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

StartsWith<T>(T, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)

Assert.StartsWith.cs

Asserts that an enumerable starts with the specified value.

public static void StartsWith<T>(T expected, IEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected T
The value expected at the start of actual.
actual IEnumerable<T>?
The enumerable to inspect.
comparer IEqualityComparer<T>?
The comparer used to compare values.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

StartsWith<T>(T, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)

Assert.StartsWith.cs

Asserts that a span starts with the specified value.

public static void StartsWith<T>(T expected, ReadOnlySpan<T> actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected T
The value expected at the start of actual.
actual ReadOnlySpan<T>
The span to inspect.
comparer IEqualityComparer<T>?
The comparer used to compare values.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

StartsWith<T>(T, T[]?, IEqualityComparer<T>?, string?, string?, string?)

Assert.StartsWith.cs

Asserts that an array starts with the specified value.

public static void StartsWith<T>(T expected, T[]? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expected T
The value expected at the start of actual.
actual T[]?
The array to inspect.
comparer IEqualityComparer<T>?
The comparer used to compare values.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected value.

Subset overloads

Subset(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)

Assert.Set.cs

Asserts that actual is a subset of expectedSuperset.

public static void Subset(IEnumerable expectedSuperset, IEnumerable? actual, IEqualityComparer? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expectedSuperset IEnumerable
The collection expected to contain every unique item in actual.
actual IEnumerable?
The collection expected to be a subset of expectedSuperset.
comparer IEqualityComparer?
The comparer used to compare values.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected superset.

Subset<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)

Assert.Set.cs

Asserts that actual is a subset of expectedSuperset, like actual.IsSubsetOf(expectedSuperset).

public static void Subset<T>(IEnumerable<T> expectedSuperset, IEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expectedSuperset IEnumerable<T>
The collection expected to contain every unique item in actual.
actual IEnumerable<T>?
The collection expected to be a subset of expectedSuperset.
comparer IEqualityComparer<T>?
The comparer used to compare values. When null and actual is a set, the set compares values itself, like ISet<T>.IsSubsetOf; otherwise EqualityComparer<T>.Default is used.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected superset.

Superset overloads

Superset(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)

Assert.Set.cs

Asserts that actual is a superset of expectedSubset.

public static void Superset(IEnumerable expectedSubset, IEnumerable? actual, IEqualityComparer? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Parameters
expectedSubset IEnumerable
The collection whose unique items are all expected in actual.
actual IEnumerable?
The collection expected to be a superset of expectedSubset.
comparer IEqualityComparer?
The comparer used to compare values.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected subset.

Superset<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)

Assert.Set.cs

Asserts that actual is a superset of expectedSubset, like actual.IsSupersetOf(expectedSubset).

public static void Superset<T>(IEnumerable<T> expectedSubset, IEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)
Type parameters
T
Parameters
expectedSubset IEnumerable<T>
The collection whose unique items are all expected in actual.
actual IEnumerable<T>?
The collection expected to be a superset of expectedSubset.
comparer IEqualityComparer<T>?
The comparer used to compare values. When null and actual is a set, the set compares values itself, like ISet<T>.IsSupersetOf; otherwise EqualityComparer<T>.Default is used.
message string?
actualExpression string?
The expression that produced the actual value.
expectedExpression string?
The expression that produced the expected subset.

Throws overloads

Throws(Type, Action, string?, string?)

Assert.Throws.cs

Asserts that the action throws an exception exactly of the specified type.

public static Exception Throws(Type expectedExceptionType, Action action, string? message = null, string? actionExpression = null)
Parameters
expectedExceptionType Type
The exact expected exception type.
action Action
The action expected to throw.
message string?
actionExpression string?
The expression that produced the action.
Returns

Exception The thrown exception.

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

Assert.Throws.cs

Asserts that the function throws an exception exactly of the specified type.

public static Exception Throws(Type expectedExceptionType, Func<object?> action, string? message = null, string? actionExpression = null)
Parameters
expectedExceptionType Type
The exact expected exception type.
action Func<object?>
The function expected to throw.
message string?
actionExpression string?
The expression that produced the function.
Returns

Exception The thrown exception.

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

Assert.Throws.cs

Asserts that the asynchronous function throws an exception exactly of the specified type.

net10.0

public static Task<Exception> Throws(Type expectedExceptionType, Func<Task<object?>> action, string? message = null, string? actionExpression = null)

net11.0

public static Task<Exception> Throws(Type expectedExceptionType, Func<Task<object?>> action, string? message = null, string? actionExpression = null)
Parameters
expectedExceptionType Type
The exact expected exception type.
action Func<Task<object?>>
The asynchronous function expected to throw.
message string?
actionExpression string?
The expression that produced the function.
Returns

Task<Exception> The thrown exception.

Throws(Type, Func<Task>, string?, string?)

Assert.Throws.cs

Asserts that the asynchronous action throws an exception exactly of the specified type.

net10.0

public static Task<Exception> Throws(Type expectedExceptionType, Func<Task> action, string? message = null, string? actionExpression = null)

net11.0

public static Task<Exception> Throws(Type expectedExceptionType, Func<Task> action, string? message = null, string? actionExpression = null)
Parameters
expectedExceptionType Type
The exact expected exception type.
action Func<Task>
The asynchronous action expected to throw.
message string?
actionExpression string?
The expression that produced the action.
Returns

Task<Exception> The thrown exception.

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

Assert.Throws.cs

Asserts that the asynchronous function throws an exception exactly of the specified type.

net10.0

public static Task<Exception> Throws(Type expectedExceptionType, Func<ValueTask<object?>> action, string? message = null, string? actionExpression = null)

net11.0

public static Task<Exception> Throws(Type expectedExceptionType, Func<ValueTask<object?>> action, string? message = null, string? actionExpression = null)
Parameters
expectedExceptionType Type
The exact expected exception type.
action Func<ValueTask<object?>>
The asynchronous function expected to throw.
message string?
actionExpression string?
The expression that produced the function.
Returns

Task<Exception> The thrown exception.

Throws(Type, Func<ValueTask>, string?, string?)

Assert.Throws.cs

Asserts that the asynchronous action throws an exception exactly of the specified type.

net10.0

public static Task<Exception> Throws(Type expectedExceptionType, Func<ValueTask> action, string? message = null, string? actionExpression = null)

net11.0

public static Task<Exception> Throws(Type expectedExceptionType, Func<ValueTask> action, string? message = null, string? actionExpression = null)
Parameters
expectedExceptionType Type
The exact expected exception type.
action Func<ValueTask>
The asynchronous action expected to throw.
message string?
actionExpression string?
The expression that produced the action.
Returns

Task<Exception> The thrown exception.

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

Assert.Throws.cs

Asserts that the action throws an exception exactly of the specified type.

public static T Throws<T>(Action action, string? message = null, string? actionExpression = null) where T : Exception
Type parameters
T
The exact expected exception type.
Parameters
action Action
The action expected to throw.
message string?
actionExpression string?
The expression that produced the action.
Returns

T The thrown exception.

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

Assert.Throws.cs

Asserts that the function throws an exception exactly of the specified type.

public static T Throws<T>(Func<object?> action, string? message = null, string? actionExpression = null) where T : Exception
Type parameters
T
The exact expected exception type.
Parameters
action Func<object?>
The function expected to throw.
message string?
actionExpression string?
The expression that produced the function.
Returns

T The thrown exception.

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

Assert.Throws.cs

Asserts that the asynchronous function throws an exception exactly of the specified type.

net10.0

public static Task<T> Throws<T>(Func<Task<object?>> action, string? message = null, string? actionExpression = null) where T : Exception

net11.0

public static Task<T> Throws<T>(Func<Task<object?>> action, string? message = null, string? actionExpression = null) where T : Exception
Type parameters
T
The exact expected exception type.
Parameters
action Func<Task<object?>>
The asynchronous function expected to throw.
message string?
actionExpression string?
The expression that produced the function.
Returns

Task<T> The thrown exception.

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

Assert.Throws.cs

Asserts that the asynchronous action throws an exception exactly of the specified type.

net10.0

public static Task<T> Throws<T>(Func<Task> action, string? message = null, string? actionExpression = null) where T : Exception

net11.0

public static Task<T> Throws<T>(Func<Task> action, string? message = null, string? actionExpression = null) where T : Exception
Type parameters
T
The exact expected exception type.
Parameters
action Func<Task>
The asynchronous action expected to throw.
message string?
actionExpression string?
The expression that produced the action.
Returns

Task<T> The thrown exception.

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

Assert.Throws.cs

Asserts that the asynchronous function throws an exception exactly of the specified type.

net10.0

public static Task<T> Throws<T>(Func<ValueTask<object?>> action, string? message = null, string? actionExpression = null) where T : Exception

net11.0

public static Task<T> Throws<T>(Func<ValueTask<object?>> action, string? message = null, string? actionExpression = null) where T : Exception
Type parameters
T
The exact expected exception type.
Parameters
action Func<ValueTask<object?>>
The asynchronous function expected to throw.
message string?
actionExpression string?
The expression that produced the function.
Returns

Task<T> The thrown exception.

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

Assert.Throws.cs

Asserts that the asynchronous action throws an exception exactly of the specified type.

net10.0

public static Task<T> Throws<T>(Func<ValueTask> action, string? message = null, string? actionExpression = null) where T : Exception

net11.0

public static Task<T> Throws<T>(Func<ValueTask> action, string? message = null, string? actionExpression = null) where T : Exception
Type parameters
T
The exact expected exception type.
Parameters
action Func<ValueTask>
The asynchronous action expected to throw.
message string?
actionExpression string?
The expression that produced the action.
Returns

Task<T> The thrown exception.

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

Assert.Throws.cs

Asserts that the action throws an exception exactly of the specified type, whose ArgumentException.ParamName is paramName.

public static T Throws<T>(string? paramName, Action action, string? message = null, string? actionExpression = null) where T : ArgumentException
Type parameters
T
The exact expected exception type.
Parameters
paramName string?
The expected parameter name.
action Action
The action expected to throw.
message string?
actionExpression string?
The expression that produced the action.
Returns

T The thrown exception.

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

Assert.Throws.cs

Asserts that the function throws an exception exactly of the specified type, whose ArgumentException.ParamName is paramName.

public static T Throws<T>(string? paramName, Func<object?> action, string? message = null, string? actionExpression = null) where T : ArgumentException
Type parameters
T
The exact expected exception type.
Parameters
paramName string?
The expected parameter name.
action Func<object?>
The function expected to throw.
message string?
actionExpression string?
The expression that produced the function.
Returns

T The thrown exception.

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

Assert.Throws.cs

Asserts that the asynchronous function throws an exception exactly of the specified type, whose ArgumentException.ParamName is paramName.

net10.0

public static Task<T> Throws<T>(string? paramName, Func<Task<object?>> action, string? message = null, string? actionExpression = null) where T : ArgumentException

net11.0

public static Task<T> Throws<T>(string? paramName, Func<Task<object?>> action, string? message = null, string? actionExpression = null) where T : ArgumentException
Type parameters
T
The exact expected exception type.
Parameters
paramName string?
The expected parameter name.
action Func<Task<object?>>
The asynchronous function expected to throw.
message string?
actionExpression string?
The expression that produced the function.
Returns

Task<T> The thrown exception.

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

Assert.Throws.cs

Asserts that the asynchronous action throws an exception exactly of the specified type, whose ArgumentException.ParamName is paramName.

net10.0

public static Task<T> Throws<T>(string? paramName, Func<Task> action, string? message = null, string? actionExpression = null) where T : ArgumentException

net11.0

public static Task<T> Throws<T>(string? paramName, Func<Task> action, string? message = null, string? actionExpression = null) where T : ArgumentException
Type parameters
T
The exact expected exception type.
Parameters
paramName string?
The expected parameter name.
action Func<Task>
The asynchronous action expected to throw.
message string?
actionExpression string?
The expression that produced the action.
Returns

Task<T> The thrown exception.

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

Assert.Throws.cs

Asserts that the asynchronous function throws an exception exactly of the specified type, whose ArgumentException.ParamName is paramName.

net10.0

public static Task<T> Throws<T>(string? paramName, Func<ValueTask<object?>> action, string? message = null, string? actionExpression = null) where T : ArgumentException

net11.0

public static Task<T> Throws<T>(string? paramName, Func<ValueTask<object?>> action, string? message = null, string? actionExpression = null) where T : ArgumentException
Type parameters
T
The exact expected exception type.
Parameters
paramName string?
The expected parameter name.
action Func<ValueTask<object?>>
The asynchronous function expected to throw.
message string?
actionExpression string?
The expression that produced the function.
Returns

Task<T> The thrown exception.

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

Assert.Throws.cs

Asserts that the asynchronous action throws an exception exactly of the specified type, whose ArgumentException.ParamName is paramName.

net10.0

public static Task<T> Throws<T>(string? paramName, Func<ValueTask> action, string? message = null, string? actionExpression = null) where T : ArgumentException

net11.0

public static Task<T> Throws<T>(string? paramName, Func<ValueTask> action, string? message = null, string? actionExpression = null) where T : ArgumentException
Type parameters
T
The exact expected exception type.
Parameters
paramName string?
The expected parameter name.
action Func<ValueTask>
The asynchronous action expected to throw.
message string?
actionExpression string?
The expression that produced the action.
Returns

Task<T> The thrown exception.

ThrowsAny overloads

ThrowsAny(Type, Action, string?, string?)

Assert.Throws.cs

Asserts that the action throws an exception assignable to the specified type.

public static Exception ThrowsAny(Type expectedExceptionType, Action action, string? message = null, string? actionExpression = null)
Parameters
expectedExceptionType Type
The expected base exception type.
action Action
The action expected to throw.
message string?
actionExpression string?
The expression that produced the action.
Returns

Exception The thrown exception.

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

Assert.Throws.cs

Asserts that the function throws an exception assignable to the specified type.

public static Exception ThrowsAny(Type expectedExceptionType, Func<object?> action, string? message = null, string? actionExpression = null)
Parameters
expectedExceptionType Type
The expected base exception type.
action Func<object?>
The function expected to throw.
message string?
actionExpression string?
The expression that produced the function.
Returns

Exception The thrown exception.

ThrowsAny(Type, Func<Task<object?>>, string?, string?)

Assert.Throws.cs

Asserts that the asynchronous function throws an exception assignable to the specified type.

net10.0

public static Task<Exception> ThrowsAny(Type expectedExceptionType, Func<Task<object?>> action, string? message = null, string? actionExpression = null)

net11.0

public static Task<Exception> ThrowsAny(Type expectedExceptionType, Func<Task<object?>> action, string? message = null, string? actionExpression = null)
Parameters
expectedExceptionType Type
The expected base exception type.
action Func<Task<object?>>
The asynchronous function expected to throw.
message string?
actionExpression string?
The expression that produced the function.
Returns

Task<Exception> The thrown exception.

ThrowsAny(Type, Func<Task>, string?, string?)

Assert.Throws.cs

Asserts that the asynchronous action throws an exception assignable to the specified type.

net10.0

public static Task<Exception> ThrowsAny(Type expectedExceptionType, Func<Task> action, string? message = null, string? actionExpression = null)

net11.0

public static Task<Exception> ThrowsAny(Type expectedExceptionType, Func<Task> action, string? message = null, string? actionExpression = null)
Parameters
expectedExceptionType Type
The expected base exception type.
action Func<Task>
The asynchronous action expected to throw.
message string?
actionExpression string?
The expression that produced the action.
Returns

Task<Exception> The thrown exception.

ThrowsAny(Type, Func<ValueTask<object?>>, string?, string?)

Assert.Throws.cs

Asserts that the asynchronous function throws an exception assignable to the specified type.

net10.0

public static Task<Exception> ThrowsAny(Type expectedExceptionType, Func<ValueTask<object?>> action, string? message = null, string? actionExpression = null)

net11.0

public static Task<Exception> ThrowsAny(Type expectedExceptionType, Func<ValueTask<object?>> action, string? message = null, string? actionExpression = null)
Parameters
expectedExceptionType Type
The expected base exception type.
action Func<ValueTask<object?>>
The asynchronous function expected to throw.
message string?
actionExpression string?
The expression that produced the function.
Returns

Task<Exception> The thrown exception.

ThrowsAny(Type, Func<ValueTask>, string?, string?)

Assert.Throws.cs

Asserts that the asynchronous action throws an exception assignable to the specified type.

net10.0

public static Task<Exception> ThrowsAny(Type expectedExceptionType, Func<ValueTask> action, string? message = null, string? actionExpression = null)

net11.0

public static Task<Exception> ThrowsAny(Type expectedExceptionType, Func<ValueTask> action, string? message = null, string? actionExpression = null)
Parameters
expectedExceptionType Type
The expected base exception type.
action Func<ValueTask>
The asynchronous action expected to throw.
message string?
actionExpression string?
The expression that produced the action.
Returns

Task<Exception> The thrown exception.

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

Assert.Throws.cs

Asserts that the action throws an exception assignable to the specified type.

public static T ThrowsAny<T>(Action action, string? message = null, string? actionExpression = null) where T : Exception
Type parameters
T
The expected base exception type.
Parameters
action Action
The action expected to throw.
message string?
actionExpression string?
The expression that produced the action.
Returns

T The thrown exception.

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

Assert.Throws.cs

Asserts that the function throws an exception assignable to the specified type.

public static T ThrowsAny<T>(Func<object?> action, string? message = null, string? actionExpression = null) where T : Exception
Type parameters
T
The expected base exception type.
Parameters
action Func<object?>
The function expected to throw.
message string?
actionExpression string?
The expression that produced the function.
Returns

T The thrown exception.

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

Assert.Throws.cs

Asserts that the asynchronous function throws an exception assignable to the specified type.

net10.0

public static Task<T> ThrowsAny<T>(Func<Task<object?>> action, string? message = null, string? actionExpression = null) where T : Exception

net11.0

public static Task<T> ThrowsAny<T>(Func<Task<object?>> action, string? message = null, string? actionExpression = null) where T : Exception
Type parameters
T
The expected base exception type.
Parameters
action Func<Task<object?>>
The asynchronous function expected to throw.
message string?
actionExpression string?
The expression that produced the function.
Returns

Task<T> The thrown exception.

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

Assert.Throws.cs

Asserts that the asynchronous action throws an exception assignable to the specified type.

net10.0

public static Task<T> ThrowsAny<T>(Func<Task> action, string? message = null, string? actionExpression = null) where T : Exception

net11.0

public static Task<T> ThrowsAny<T>(Func<Task> action, string? message = null, string? actionExpression = null) where T : Exception
Type parameters
T
The expected base exception type.
Parameters
action Func<Task>
The asynchronous action expected to throw.
message string?
actionExpression string?
The expression that produced the action.
Returns

Task<T> The thrown exception.

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

Assert.Throws.cs

Asserts that the asynchronous function throws an exception assignable to the specified type.

net10.0

public static Task<T> ThrowsAny<T>(Func<ValueTask<object?>> action, string? message = null, string? actionExpression = null) where T : Exception

net11.0

public static Task<T> ThrowsAny<T>(Func<ValueTask<object?>> action, string? message = null, string? actionExpression = null) where T : Exception
Type parameters
T
The expected base exception type.
Parameters
action Func<ValueTask<object?>>
The asynchronous function expected to throw.
message string?
actionExpression string?
The expression that produced the function.
Returns

Task<T> The thrown exception.

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

Assert.Throws.cs

Asserts that the asynchronous action throws an exception assignable to the specified type.

net10.0

public static Task<T> ThrowsAny<T>(Func<ValueTask> action, string? message = null, string? actionExpression = null) where T : Exception

net11.0

public static Task<T> ThrowsAny<T>(Func<ValueTask> action, string? message = null, string? actionExpression = null) where T : Exception
Type parameters
T
The expected base exception type.
Parameters
action Func<ValueTask>
The asynchronous action expected to throw.
message string?
actionExpression string?
The expression that produced the action.
Returns

Task<T> The thrown exception.

ThrowsAnyAsync overloads

ThrowsAnyAsync(Type, Func<Task<object?>>, string?, string?)

Assert.Throws.cs

Compatibility shim for xUnit. Asserts that the asynchronous function throws an exception assignable to the specified type.

net10.0

public static Task<Exception> ThrowsAnyAsync(Type expectedExceptionType, Func<Task<object?>> action, string? message = null, string? actionExpression = null)

net11.0

public static Task<Exception> ThrowsAnyAsync(Type expectedExceptionType, Func<Task<object?>> action, string? message = null, string? actionExpression = null)
Parameters
expectedExceptionType Type
The expected base exception type.
action Func<Task<object?>>
The asynchronous function expected to throw.
message string?
actionExpression string?
The expression that produced the function.
Returns

Task<Exception> The thrown exception.

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

Assert.Throws.cs

Compatibility shim for xUnit. Asserts that the asynchronous action throws an exception assignable to the specified type.

net10.0

public static Task<Exception> ThrowsAnyAsync(Type expectedExceptionType, Func<Task> action, string? message = null, string? actionExpression = null)

net11.0

public static Task<Exception> ThrowsAnyAsync(Type expectedExceptionType, Func<Task> action, string? message = null, string? actionExpression = null)
Parameters
expectedExceptionType Type
The expected base exception type.
action Func<Task>
The asynchronous action expected to throw.
message string?
actionExpression string?
The expression that produced the action.
Returns

Task<Exception> The thrown exception.

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

Assert.Throws.cs

Compatibility shim for xUnit. Asserts that the asynchronous function throws an exception assignable to the specified type.

net10.0

public static Task<T> ThrowsAnyAsync<T>(Func<Task<object?>> action, string? message = null, string? actionExpression = null) where T : Exception

net11.0

public static Task<T> ThrowsAnyAsync<T>(Func<Task<object?>> action, string? message = null, string? actionExpression = null) where T : Exception
Type parameters
T
The expected base exception type.
Parameters
action Func<Task<object?>>
The asynchronous function expected to throw.
message string?
actionExpression string?
The expression that produced the function.
Returns

Task<T> The thrown exception.

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

Assert.Throws.cs

Compatibility shim for xUnit. Asserts that the asynchronous action throws an exception assignable to the specified type.

net10.0

public static Task<T> ThrowsAnyAsync<T>(Func<Task> action, string? message = null, string? actionExpression = null) where T : Exception

net11.0

public static Task<T> ThrowsAnyAsync<T>(Func<Task> action, string? message = null, string? actionExpression = null) where T : Exception
Type parameters
T
The expected base exception type.
Parameters
action Func<Task>
The asynchronous action expected to throw.
message string?
actionExpression string?
The expression that produced the action.
Returns

Task<T> The thrown exception.

ThrowsAsync overloads

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

Assert.Throws.cs

Compatibility shim for xUnit. Asserts that the asynchronous function throws an exception exactly of the specified type.

net10.0

public static Task<Exception> ThrowsAsync(Type expectedExceptionType, Func<Task<object?>> action, string? message = null, string? actionExpression = null)

net11.0

public static Task<Exception> ThrowsAsync(Type expectedExceptionType, Func<Task<object?>> action, string? message = null, string? actionExpression = null)
Parameters
expectedExceptionType Type
The exact expected exception type.
action Func<Task<object?>>
The asynchronous function expected to throw.
message string?
actionExpression string?
The expression that produced the function.
Returns

Task<Exception> The thrown exception.

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

Assert.Throws.cs

Compatibility shim for xUnit. Asserts that the asynchronous action throws an exception exactly of the specified type.

net10.0

public static Task<Exception> ThrowsAsync(Type expectedExceptionType, Func<Task> action, string? message = null, string? actionExpression = null)

net11.0

public static Task<Exception> ThrowsAsync(Type expectedExceptionType, Func<Task> action, string? message = null, string? actionExpression = null)
Parameters
expectedExceptionType Type
The exact expected exception type.
action Func<Task>
The asynchronous action expected to throw.
message string?
actionExpression string?
The expression that produced the action.
Returns

Task<Exception> The thrown exception.

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

Assert.Throws.cs

Compatibility shim for xUnit. Asserts that the asynchronous function throws an exception exactly of the specified type.

net10.0

public static Task<T> ThrowsAsync<T>(Func<Task<object?>> action, string? message = null, string? actionExpression = null) where T : Exception

net11.0

public static Task<T> ThrowsAsync<T>(Func<Task<object?>> action, string? message = null, string? actionExpression = null) where T : Exception
Type parameters
T
The exact expected exception type.
Parameters
action Func<Task<object?>>
The asynchronous function expected to throw.
message string?
actionExpression string?
The expression that produced the function.
Returns

Task<T> The thrown exception.

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

Assert.Throws.cs

Compatibility shim for xUnit. Asserts that the asynchronous action throws an exception exactly of the specified type.

net10.0

public static Task<T> ThrowsAsync<T>(Func<Task> action, string? message = null, string? actionExpression = null) where T : Exception

net11.0

public static Task<T> ThrowsAsync<T>(Func<Task> action, string? message = null, string? actionExpression = null) where T : Exception
Type parameters
T
The exact expected exception type.
Parameters
action Func<Task>
The asynchronous action expected to throw.
message string?
actionExpression string?
The expression that produced the action.
Returns

Task<T> The thrown exception.

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

Assert.Throws.cs

Compatibility shim for xUnit. Asserts that the asynchronous action throws an exception exactly of the specified type, whose ArgumentException.ParamName is paramName.

net10.0

public static Task<T> ThrowsAsync<T>(string? paramName, Func<Task> action, string? message = null, string? actionExpression = null) where T : ArgumentException

net11.0

public static Task<T> ThrowsAsync<T>(string? paramName, Func<Task> action, string? message = null, string? actionExpression = null) where T : ArgumentException
Type parameters
T
The exact expected exception type.
Parameters
paramName string?
The expected parameter name.
action Func<Task>
The asynchronous action expected to throw.
message string?
actionExpression string?
The expression that produced the action.
Returns

Task<T> The thrown exception.

True overloads

True(bool, string?, string?)

Assert.True.cs

Asserts that a condition is true. If the condition is false, an AssertionException is thrown.

public static void True(bool condition, string? message = null, string? expression = null)
Parameters
condition bool
The condition to evaluate.
message string?
The message that describes the failure.
expression string?
The expression that caused the failure.

True(bool?, string?, string?)

Assert.True.cs

Asserts that a nullable condition is true. If the condition is false or null, an AssertionException is thrown.

public static void True(bool? condition, string? message = null, string? expression = null)
Parameters
condition bool?
The nullable condition to evaluate.
message string?
The message that describes the failure.
expression string?
The expression that caused the failure.

UseFormatterOptions(FormatterOptions)

Assert.cs

Uses the specified options to format assertion failure messages in the current asynchronous flow, until the returned scope is disposed.

public static IDisposable UseFormatterOptions(FormatterOptions options)

Parameters

options FormatterOptions
The options to use instead of Assert.FormatterOptions.

Returns

IDisposable A scope that restores the previous options when disposed.

Remarks

The options flow to the code called by the current method, including asynchronous continuations and tasks started from it, but not to other tests running in parallel. Scopes can be nested.

XunitSkip(string)

Assert.XunitSkip.cs

Skips the currently running xunit test by throwing an AssertionException whose message uses the format expected by xunit for dynamically skipped tests.

public static void XunitSkip(string reason)

Parameters

reason string
The reason why the test is skipped.