Assert Class
public static class AssertNo documentation is available.
Properties
| Name | Description |
|---|---|
| Architecture | Gets the assertions on the dependencies of the types of an ArchitectureModel, such as Assert.Architecture.DoesNotDependOn(domain, infrastructure). |
| FormatterOptions | Gets or sets the options used to format assertion failure messages. |
Architecture
Assert.Architecture.csGets 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
FormatterOptions
Assert.csGets or sets the options used to format assertion failure messages.
public static FormatterOptions FormatterOptions { get; set; }Property value
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
All overloads
All(IEnumerable?, Action<object?, int>, string?, string?, string?)
Assert.All.csAsserts 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
actualIEnumerable?- The enumerable to inspect.
assertionAction<object?, int>- The assertion to run for each item and index.
messagestring?actualExpressionstring?- The expression that produced the actual value.
assertionExpressionstring?- The expression that produced the assertion.
All(IEnumerable?, Action<object?>, string?, string?, string?)
Assert.All.csAsserts 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
actualIEnumerable?- The enumerable to inspect.
assertionAction<object?>- The assertion to run for each item.
messagestring?actualExpressionstring?- The expression that produced the actual value.
assertionExpressionstring?- The expression that produced the assertion.
All<T>(IAsyncEnumerable<T>?, Action<T, int>, string?, string?, string?)
Assert.All.csAsserts 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
actualIAsyncEnumerable<T>?- The sequence to inspect.
assertionAction<T, int>- The assertion to run for each item and index.
messagestring?actualExpressionstring?- The expression that produced the actual value.
assertionExpressionstring?- The expression that produced the assertion.
Returns
All<T>(IAsyncEnumerable<T>?, Action<T>, string?, string?, string?)
Assert.All.csAsserts 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)All<T>(IAsyncEnumerable<T>?, Func<T, int, Task>, string?, string?, string?)
Assert.All.csAsserts 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
actualIAsyncEnumerable<T>?- The sequence to inspect.
assertionFunc<T, int, Task>- The assertion to run for each item and index.
messagestring?actualExpressionstring?- The expression that produced the actual value.
assertionExpressionstring?- The expression that produced the assertion.
Returns
All<T>(IAsyncEnumerable<T>?, Func<T, Task>, string?, string?, string?)
Assert.All.csAsserts 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
actualIAsyncEnumerable<T>?- The sequence to inspect.
assertionFunc<T, Task>- The assertion to run for each item.
messagestring?actualExpressionstring?- The expression that produced the actual value.
assertionExpressionstring?- The expression that produced the assertion.
Returns
All<T>(IEnumerable<T>?, Action<T, int>, string?, string?, string?)
Assert.All.csAsserts 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
actualIEnumerable<T>?- The enumerable to inspect.
assertionAction<T, int>- The assertion to run for each item and index.
messagestring?actualExpressionstring?- The expression that produced the actual value.
assertionExpressionstring?- The expression that produced the assertion.
All<T>(IEnumerable<T>?, Action<T>, string?, string?, string?)
Assert.All.csAsserts 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
actualIEnumerable<T>?- The enumerable to inspect.
assertionAction<T>- The assertion to run for each item.
messagestring?actualExpressionstring?- The expression that produced the actual value.
assertionExpressionstring?- The expression that produced the assertion.
All<T>(IEnumerable<T>?, Func<T, bool>, string?, string?, string?)
Assert.All.csAsserts 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
actualIEnumerable<T>?- The enumerable to inspect.
predicateFunc<T, bool>- The predicate that every item must satisfy.
messagestring?actualExpressionstring?- The expression that produced the actual value.
predicateExpressionstring?- The expression that produced the predicate.
All<T>(ReadOnlySpan<T>, Action<T, int>, string?, string?, string?)
Assert.All.csAsserts 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
actualReadOnlySpan<T>- The span to inspect.
assertionAction<T, int>- The assertion to run for each item and index.
messagestring?actualExpressionstring?- The expression that produced the actual value.
assertionExpressionstring?- The expression that produced the assertion.
All<T>(ReadOnlySpan<T>, Action<T>, string?, string?, string?)
Assert.All.csAsserts 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
actualReadOnlySpan<T>- The span to inspect.
assertionAction<T>- The assertion to run for each item.
messagestring?actualExpressionstring?- The expression that produced the actual value.
assertionExpressionstring?- The expression that produced the assertion.
All<T>(T[]?, Action<T, int>, string?, string?, string?)
Assert.All.csAsserts 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
actualT[]?- The array to inspect.
assertionAction<T, int>- The assertion to run for each item and index.
messagestring?actualExpressionstring?- The expression that produced the actual value.
assertionExpressionstring?- 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.csAsserts 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
actualT[]?- The array to inspect.
assertionAction<T>- The assertion to run for each item.
messagestring?actualExpressionstring?- The expression that produced the actual value.
assertionExpressionstring?- 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.csAsserts 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
actualT[]?- The array to inspect.
predicateFunc<T, bool>- The predicate that every item must satisfy.
messagestring?actualExpressionstring?- The expression that produced the actual value.
predicateExpressionstring?- 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.cspublic 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
actualIEnumerable<T>?inspector1Action<T>inspector2Action<T>inspector3Action<T>inspector4Action<T>inspector5Action<T>inspector6Action<T>inspector7Action<T>inspector8Action<T>inspector9Action<T>inspector10Action<T>inspector11Action<T>inspector12Action<T>inspector13Action<T>inspector14Action<T>inspector15Action<T>inspector16Action<T>messagestring?actualExpressionstring?
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.cspublic 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
actualIEnumerable<T>?inspector1Action<T>inspector2Action<T>inspector3Action<T>inspector4Action<T>inspector5Action<T>inspector6Action<T>inspector7Action<T>inspector8Action<T>inspector9Action<T>inspector10Action<T>inspector11Action<T>inspector12Action<T>inspector13Action<T>inspector14Action<T>inspector15Action<T>messagestring?actualExpressionstring?
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.cspublic 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
actualIEnumerable<T>?inspector1Action<T>inspector2Action<T>inspector3Action<T>inspector4Action<T>inspector5Action<T>inspector6Action<T>inspector7Action<T>inspector8Action<T>inspector9Action<T>inspector10Action<T>inspector11Action<T>inspector12Action<T>inspector13Action<T>inspector14Action<T>messagestring?actualExpressionstring?
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.cspublic 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
actualIEnumerable<T>?inspector1Action<T>inspector2Action<T>inspector3Action<T>inspector4Action<T>inspector5Action<T>inspector6Action<T>inspector7Action<T>inspector8Action<T>inspector9Action<T>inspector10Action<T>inspector11Action<T>inspector12Action<T>inspector13Action<T>messagestring?actualExpressionstring?
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.cspublic 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
actualIEnumerable<T>?inspector1Action<T>inspector2Action<T>inspector3Action<T>inspector4Action<T>inspector5Action<T>inspector6Action<T>inspector7Action<T>inspector8Action<T>inspector9Action<T>inspector10Action<T>inspector11Action<T>inspector12Action<T>messagestring?actualExpressionstring?
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.cspublic 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
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.cspublic 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
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.cspublic 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
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.cspublic 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
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.cspublic 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
No documentation is available.
Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, string?, string?)
Assert.Collection.cspublic 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
No documentation is available.
Collection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, Action<T>, Action<T>, string?, string?)
Assert.Collection.csCollection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, Action<T>, string?, string?)
Assert.Collection.csCollection<T>(IEnumerable<T>?, Action<T>, Action<T>, Action<T>, string?, string?)
Assert.Collection.csCollection<T>(IEnumerable<T>?, Action<T>, Action<T>, string?, string?)
Assert.Collection.cspublic static void Collection<T>(IEnumerable<T>? actual, Action<T> inspector1, Action<T> inspector2, string? message = null, string? actualExpression = null)Type parameters
T
Parameters
actualIEnumerable<T>?inspector1Action<T>inspector2Action<T>messagestring?actualExpressionstring?
No documentation is available.
Collection<T>(IEnumerable<T>?, Action<T>, string?, string?)
Assert.Collection.cspublic static void Collection<T>(IEnumerable<T>? actual, Action<T> inspector1, string? message = null, string? actualExpression = null)Type parameters
T
Parameters
actualIEnumerable<T>?inspector1Action<T>messagestring?actualExpressionstring?
No documentation is available.
Collection<T>(IEnumerable<T>?, Action<T>[], string?, string?)
Assert.Collection.cspublic static void Collection<T>(IEnumerable<T>? actual, Action<T>[] inspectors, string? message = null, string? actualExpression = null)Type parameters
T
Parameters
actualIEnumerable<T>?inspectorsAction<T>[]messagestring?actualExpressionstring?
No documentation is available.
Collection<T>(IEnumerable<T>?, string?, string?)
Assert.Collection.cspublic static void Collection<T>(IEnumerable<T>? actual, string? message = null, string? actualExpression = null)No documentation is available.
Contains overloads
Contains(char, string?, IEqualityComparer<char>?, string?, string?, string?)
Assert.Contains.csAsserts 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
expectedchar- The character expected in
actual. actualstring?- The string to inspect.
comparerIEqualityComparer<char>?- The comparer used to compare characters.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
Contains(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)
Assert.Contains.csAsserts 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
expectedIEnumerable- The subsequence expected in
actual. Withoutcomparer, the assertion also succeeds whenexpectedis itself an item ofactual. A string is searched as an item, unlessactualis a sequence of characters. actualIEnumerable?- The enumerable to inspect. It is read only until the subsequence is found.
comparerIEqualityComparer?- The comparer used to compare values.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
Contains(object?, IDictionary?, string?, string?, string?)
Assert.Contains.csContains(object?, IEnumerable?, string?, string?, string?)
Assert.Contains.csAsserts 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
expectedobject?- The value expected in
actual. A string searched in a sequence of characters is searched as a substring. actualIEnumerable?- The enumerable to inspect.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
Contains(ReadOnlySpan<char>, ReadOnlySpan<char>, bool, string?, string?, string?)
Assert.Contains.csAsserts 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
expectedReadOnlySpan<char>- The substring expected in
actual. actualReadOnlySpan<char>- The span to inspect.
ignoreCasebool- When
true, the comparison ignores casing (OrdinalIgnoreCase); otherwise, it is case-sensitive (Ordinal). messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
Contains(ReadOnlySpan<char>, ReadOnlySpan<char>, StringComparison, string?, string?, string?)
Assert.Contains.csAsserts 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
expectedReadOnlySpan<char>- The substring expected in
actual. actualReadOnlySpan<char>- The span to inspect.
comparisonTypeStringComparison- The comparison used to search for
expected. messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
Contains(string, IDictionary?, string?, string?, string?)
Assert.Contains.csContains(string, string?, bool, string?, string?, string?)
Assert.Contains.csAsserts 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
expectedstring- The substring expected in
actual. actualstring?- The string to inspect.
ignoreCasebool- When
true, the comparison ignores casing (OrdinalIgnoreCase); otherwise, it is case-sensitive (Ordinal). messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
Contains(string, string?, StringComparison, string?, string?, string?)
Assert.Contains.csAsserts 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
expectedstring- The substring expected in
actual. actualstring?- The string to inspect.
comparisonTypeStringComparison- The comparison used to search for
expected. messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
Contains<T>(IEnumerable<T>, IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Assert.Contains.csAsserts 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
expectedIEnumerable<T>- The subsequence expected in
actual. Whenexpectedis itself an item ofactual, the assertion also succeeds. actualIAsyncEnumerable<T>?- The sequence to inspect. It is read only until the subsequence is found.
comparerIEqualityComparer<T>?- The comparer used to compare values.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
Returns
Contains<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Assert.Contains.csAsserts 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
expectedIEnumerable<T>- The subsequence expected in
actual. Whenexpectedis itself an item ofactual, the assertion also succeeds. actualIEnumerable<T>?- The enumerable to inspect. It is read only until the subsequence is found.
comparerIEqualityComparer<T>?- The comparer used to compare values.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
Contains<T>(IEnumerable<T>?, Func<T, bool>, string?, string?, string?)
Assert.Contains.csAsserts 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
actualIEnumerable<T>?- The enumerable to inspect.
predicateFunc<T, bool>- The predicate used to select matching items.
messagestring?actualExpressionstring?- The expression that produced the actual value.
predicateExpressionstring?- The expression that produced the predicate.
Contains<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)
Assert.Contains.csAsserts 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
expectedReadOnlySpan<T>- The subsequence expected in
actual. actualReadOnlySpan<T>- The span to inspect.
comparerIEqualityComparer<T>?- The comparer used to compare values.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
Contains<T>(T, ICollection<T>?, string?, string?, string?)
Assert.Contains.csAsserts 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
expectedT- The value expected in
actual. actualICollection<T>?- The collection to inspect.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
Contains<T>(T, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Assert.Contains.csAsserts 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
expectedT- The value expected in
actual. actualIEnumerable<T>?- The enumerable to inspect.
comparerIEqualityComparer<T>?- The comparer used to compare values. When
nullandactualis anICollection<T>, the collection decides (likeEnumerable.Contains), so a set uses its own comparer. messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
Contains<T>(T, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)
Assert.Contains.csAsserts 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
expectedT- The value expected in
actual. actualReadOnlySpan<T>- The span to inspect.
comparerIEqualityComparer<T>?- The comparer used to compare values.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
Contains<T>(T, T[]?, IEqualityComparer<T>?, string?, string?, string?)
Assert.Contains.csAsserts 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
expectedT- The value expected in
actual. actualT[]?- The array to inspect.
comparerIEqualityComparer<T>?- The comparer used to compare values.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
Contains<TKey, TValue>(TKey, Dictionary<TKey, TValue>?, string?, string?, string?)
Assert.Contains.csAsserts 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 : notnullType parameters
TKeyTValue
Parameters
expectedTKey- The key expected in
actual. actualDictionary<TKey, TValue>?- The dictionary to inspect.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected key.
Returns
TValue
Contains<TKey, TValue>(TKey, IEnumerable<KeyValuePair<TKey, TValue>>?, IEqualityComparer<TKey>?, string?, string?, string?)
Assert.Contains.csAsserts 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
TKeyTValue
Parameters
expectedTKey- The key expected in
actual. actualIEnumerable<KeyValuePair<TKey, TValue>>?- The dictionary-like collection to inspect.
comparerIEqualityComparer<TKey>?- The comparer used to compare keys. When
nullandactualis a dictionary, only the dictionary's own lookup decides. messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected key.
Returns
TValue
Distinct overloads
Distinct(IEnumerable?, IEqualityComparer?, string?, string?)
Assert.Distinct.csAsserts 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
actualIEnumerable?- The enumerable to inspect.
comparerIEqualityComparer?- The comparer used to compare values.
messagestring?actualExpressionstring?- The expression that produced the actual value.
Distinct(string?, string?, string?)
Assert.Distinct.csDistinct<T>(IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?)
Assert.Distinct.csAsserts 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
actualIAsyncEnumerable<T>?- The sequence to inspect.
comparerIEqualityComparer<T>?- The comparer used to compare values.
messagestring?actualExpressionstring?- The expression that produced the actual value.
Returns
Distinct<T>(IEnumerable<T>?, IEqualityComparer<T>?, string?, string?)
Assert.Distinct.csAsserts 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
actualIEnumerable<T>?- The enumerable to inspect.
comparerIEqualityComparer<T>?- The comparer used to compare values.
messagestring?actualExpressionstring?- The expression that produced the actual value.
Distinct<T>(ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?)
Assert.Distinct.csAsserts 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
actualReadOnlySpan<T>- The span to inspect.
comparerIEqualityComparer<T>?- The comparer used to compare values.
messagestring?actualExpressionstring?- The expression that produced the actual value.
Distinct<T>(T[]?, IEqualityComparer<T>?, string?, string?)
Assert.Distinct.csAsserts 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
actualT[]?- The array to inspect.
comparerIEqualityComparer<T>?- The comparer used to compare values.
messagestring?actualExpressionstring?- 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.csAsserts 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
actualIEnumerable<T>?- The enumerable to inspect.
predicateFunc<T, bool>- The predicate that at least one item must not satisfy.
messagestring?actualExpressionstring?- The expression that produced the actual value.
predicateExpressionstring?- The expression that produced the predicate.
DoesNotContain overloads
DoesNotContain(char, string?, IEqualityComparer<char>?, string?, string?, string?)
Assert.DoesNotContain.csDoesNotContain(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)
Assert.DoesNotContain.cspublic static void DoesNotContain(IEnumerable expected, IEnumerable? actual, IEqualityComparer? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)Parameters
expectedIEnumerableactualIEnumerable?comparerIEqualityComparer?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotContain(object?, IDictionary?, string?, string?, string?)
Assert.DoesNotContain.cspublic static void DoesNotContain(object? expected, IDictionary? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)Parameters
expectedobject?actualIDictionary?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotContain(object?, IEnumerable?, string?, string?, string?)
Assert.DoesNotContain.cspublic static void DoesNotContain(object? expected, IEnumerable? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)Parameters
expectedobject?actualIEnumerable?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotContain(ReadOnlySpan<char>, ReadOnlySpan<char>, bool, string?, string?, string?)
Assert.DoesNotContain.cspublic static void DoesNotContain(ReadOnlySpan<char> expected, ReadOnlySpan<char> actual, bool ignoreCase = false, string? message = null, string? actualExpression = null, string? expectedExpression = null)Parameters
expectedReadOnlySpan<char>actualReadOnlySpan<char>ignoreCaseboolmessagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotContain(ReadOnlySpan<char>, ReadOnlySpan<char>, StringComparison, string?, string?, string?)
Assert.DoesNotContain.cspublic static void DoesNotContain(ReadOnlySpan<char> expected, ReadOnlySpan<char> actual, StringComparison comparisonType, string? message = null, string? actualExpression = null, string? expectedExpression = null)Parameters
expectedReadOnlySpan<char>actualReadOnlySpan<char>comparisonTypeStringComparisonmessagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotContain(string, IDictionary?, string?, string?, string?)
Assert.DoesNotContain.cspublic static void DoesNotContain(string expected, IDictionary? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)Parameters
expectedstringactualIDictionary?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotContain(string, string?, bool, string?, string?, string?)
Assert.DoesNotContain.csDoesNotContain(string, string?, StringComparison, string?, string?, string?)
Assert.DoesNotContain.csDoesNotContain<T>(IEnumerable<T>, IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Assert.DoesNotContain.csnet10.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
expectedIEnumerable<T>actualIAsyncEnumerable<T>?comparerIEqualityComparer<T>?messagestring?actualExpressionstring?expectedExpressionstring?
Returns
No documentation is available.
DoesNotContain<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Assert.DoesNotContain.cspublic 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
expectedIEnumerable<T>actualIEnumerable<T>?comparerIEqualityComparer<T>?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotContain<T>(IEnumerable<T>?, Func<T, bool>, string?, string?, string?)
Assert.DoesNotContain.cspublic static void DoesNotContain<T>(IEnumerable<T>? actual, Func<T, bool> predicate, string? message = null, string? actualExpression = null, string? predicateExpression = null)Type parameters
T
Parameters
actualIEnumerable<T>?predicateFunc<T, bool>messagestring?actualExpressionstring?predicateExpressionstring?
No documentation is available.
DoesNotContain<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)
Assert.DoesNotContain.cspublic 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
expectedReadOnlySpan<T>actualReadOnlySpan<T>comparerIEqualityComparer<T>?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotContain<T>(T, ICollection<T>?, string?, string?, string?)
Assert.DoesNotContain.cspublic static void DoesNotContain<T>(T expected, ICollection<T>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)Type parameters
T
Parameters
expectedTactualICollection<T>?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotContain<T>(T, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Assert.DoesNotContain.cspublic 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
expectedTactualIEnumerable<T>?comparerIEqualityComparer<T>?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotContain<T>(T, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)
Assert.DoesNotContain.cspublic 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
expectedTactualReadOnlySpan<T>comparerIEqualityComparer<T>?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotContain<T>(T, T[]?, IEqualityComparer<T>?, string?, string?, string?)
Assert.DoesNotContain.cspublic 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
expectedTactualT[]?comparerIEqualityComparer<T>?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotContain<TKey, TValue>(TKey, Dictionary<TKey, TValue>?, string?, string?, string?)
Assert.DoesNotContain.cspublic static void DoesNotContain<TKey, TValue>(TKey expected, Dictionary<TKey, TValue>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null) where TKey : notnullType parameters
TKeyTValue
Parameters
expectedTKeyactualDictionary<TKey, TValue>?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotContain<TKey, TValue>(TKey, IEnumerable<KeyValuePair<TKey, TValue>>?, IEqualityComparer<TKey>?, string?, string?, string?)
Assert.DoesNotContain.cspublic 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
TKeyTValue
Parameters
expectedTKeyactualIEnumerable<KeyValuePair<TKey, TValue>>?comparerIEqualityComparer<TKey>?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotEndWith overloads
DoesNotEndWith(char, string?, IEqualityComparer<char>?, string?, string?, string?)
Assert.DoesNotEndWith.csDoesNotEndWith(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)
Assert.DoesNotEndWith.cspublic static void DoesNotEndWith(IEnumerable expected, IEnumerable? actual, IEqualityComparer? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)Parameters
expectedIEnumerableactualIEnumerable?comparerIEqualityComparer?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotEndWith(object?, IEnumerable?, string?, string?, string?)
Assert.DoesNotEndWith.cspublic static void DoesNotEndWith(object? expected, IEnumerable? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)Parameters
expectedobject?actualIEnumerable?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotEndWith(ReadOnlySpan<char>, ReadOnlySpan<char>, bool, string?, string?, string?)
Assert.DoesNotEndWith.cspublic static void DoesNotEndWith(ReadOnlySpan<char> expected, ReadOnlySpan<char> actual, bool ignoreCase = false, string? message = null, string? actualExpression = null, string? expectedExpression = null)Parameters
expectedReadOnlySpan<char>actualReadOnlySpan<char>ignoreCaseboolmessagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotEndWith(ReadOnlySpan<char>, ReadOnlySpan<char>, StringComparison, string?, string?, string?)
Assert.DoesNotEndWith.cspublic static void DoesNotEndWith(ReadOnlySpan<char> expected, ReadOnlySpan<char> actual, StringComparison comparisonType, string? message = null, string? actualExpression = null, string? expectedExpression = null)Parameters
expectedReadOnlySpan<char>actualReadOnlySpan<char>comparisonTypeStringComparisonmessagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotEndWith(string, string?, bool, string?, string?, string?)
Assert.DoesNotEndWith.csDoesNotEndWith(string, string?, StringComparison, string?, string?, string?)
Assert.DoesNotEndWith.csDoesNotEndWith<T>(IEnumerable<T>, IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Assert.DoesNotEndWith.csnet10.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
expectedIEnumerable<T>actualIAsyncEnumerable<T>?comparerIEqualityComparer<T>?messagestring?actualExpressionstring?expectedExpressionstring?
Returns
No documentation is available.
DoesNotEndWith<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Assert.DoesNotEndWith.cspublic 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
expectedIEnumerable<T>actualIEnumerable<T>?comparerIEqualityComparer<T>?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotEndWith<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)
Assert.DoesNotEndWith.cspublic 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
expectedReadOnlySpan<T>actualReadOnlySpan<T>comparerIEqualityComparer<T>?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotEndWith<T>(T, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Assert.DoesNotEndWith.cspublic 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
expectedTactualIEnumerable<T>?comparerIEqualityComparer<T>?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotEndWith<T>(T, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)
Assert.DoesNotEndWith.cspublic 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
expectedTactualReadOnlySpan<T>comparerIEqualityComparer<T>?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotEndWith<T>(T, T[]?, IEqualityComparer<T>?, string?, string?, string?)
Assert.DoesNotEndWith.cspublic 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
expectedTactualT[]?comparerIEqualityComparer<T>?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotHaveCount overloads
DoesNotHaveCount(int, IEnumerable?, string?, string?)
Assert.DoesNotHaveCount.cspublic static void DoesNotHaveCount(int expectedCount, IEnumerable? actual, string? message = null, string? actualExpression = null)Parameters
expectedCountintactualIEnumerable?messagestring?actualExpressionstring?
No documentation is available.
DoesNotHaveCount(int, string?, string?, string?)
Assert.DoesNotHaveCount.csDoesNotHaveCount<T>(int, IAsyncEnumerable<T>?, string?, string?)
Assert.DoesNotHaveCount.csnet10.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
expectedCountintactualIAsyncEnumerable<T>?messagestring?actualExpressionstring?
Returns
No documentation is available.
DoesNotHaveCount<T>(int, IEnumerable<T>?, string?, string?)
Assert.DoesNotHaveCount.cspublic static void DoesNotHaveCount<T>(int expectedCount, IEnumerable<T>? actual, string? message = null, string? actualExpression = null)Type parameters
T
Parameters
expectedCountintactualIEnumerable<T>?messagestring?actualExpressionstring?
No documentation is available.
DoesNotHaveCount<T>(int, ReadOnlySpan<T>, string?, string?)
Assert.DoesNotHaveCount.cspublic static void DoesNotHaveCount<T>(int expectedCount, ReadOnlySpan<T> actual, string? message = null, string? actualExpression = null)Type parameters
T
Parameters
expectedCountintactualReadOnlySpan<T>messagestring?actualExpressionstring?
No documentation is available.
DoesNotHaveCount<T>(int, T[]?, string?, string?)
Assert.DoesNotHaveCount.csDoesNotMatch overloads
DoesNotMatch(string, string, string?, string?, string?)
Assert.DoesNotMatch.csAsserts 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
patternstring- The regular expression pattern not expected to match
actual. actualstring- The string to inspect.
messagestring?actualExpressionstring?- The expression that produced the actual value.
patternExpressionstring?- 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.csDoesNotRaise overloads
DoesNotRaise(Action<EventHandler>, Action<EventHandler>, Action, string?, string?)
Assert.DoesNotRaise.cspublic static void DoesNotRaise(Action<EventHandler> attach, Action<EventHandler> detach, Action action, string? message = null, string? actionExpression = null)Parameters
attachAction<EventHandler>detachAction<EventHandler>actionActionmessagestring?actionExpressionstring?
No documentation is available.
DoesNotRaise(Action<EventHandler>, Action<EventHandler>, Func<Task>, string?, string?)
Assert.DoesNotRaise.csnet10.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
attachAction<EventHandler>detachAction<EventHandler>actionFunc<Task>messagestring?actionExpressionstring?
Returns
No documentation is available.
DoesNotRaise(Action<EventHandler>, Action<EventHandler>, Func<ValueTask>, string?, string?)
Assert.DoesNotRaise.csnet10.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
attachAction<EventHandler>detachAction<EventHandler>actionFunc<ValueTask>messagestring?actionExpressionstring?
Returns
No documentation is available.
DoesNotRaise<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Action, string?, string?)
Assert.DoesNotRaise.cspublic static void DoesNotRaise<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Action action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgsType parameters
TEventArgs
Parameters
attachAction<EventHandler<TEventArgs>>detachAction<EventHandler<TEventArgs>>actionActionmessagestring?actionExpressionstring?
No documentation is available.
DoesNotRaise<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<Task>, string?, string?)
Assert.DoesNotRaise.csnet10.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 : EventArgsnet11.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 : EventArgsType parameters
TEventArgs
Parameters
attachAction<EventHandler<TEventArgs>>detachAction<EventHandler<TEventArgs>>actionFunc<Task>messagestring?actionExpressionstring?
Returns
No documentation is available.
DoesNotRaise<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<ValueTask>, string?, string?)
Assert.DoesNotRaise.csnet10.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 : EventArgsnet11.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 : EventArgsType parameters
TEventArgs
Parameters
attachAction<EventHandler<TEventArgs>>detachAction<EventHandler<TEventArgs>>actionFunc<ValueTask>messagestring?actionExpressionstring?
Returns
No documentation is available.
DoesNotRaiseAny overloads
DoesNotRaiseAny(Action<EventHandler>, Action<EventHandler>, Action, string?, string?)
Assert.DoesNotRaise.cspublic static void DoesNotRaiseAny(Action<EventHandler> attach, Action<EventHandler> detach, Action action, string? message = null, string? actionExpression = null)Parameters
attachAction<EventHandler>detachAction<EventHandler>actionActionmessagestring?actionExpressionstring?
No documentation is available.
DoesNotRaiseAny(Action<EventHandler>, Action<EventHandler>, Func<Task>, string?, string?)
Assert.DoesNotRaise.csnet10.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
attachAction<EventHandler>detachAction<EventHandler>actionFunc<Task>messagestring?actionExpressionstring?
Returns
No documentation is available.
DoesNotRaiseAny(Action<EventHandler>, Action<EventHandler>, Func<ValueTask>, string?, string?)
Assert.DoesNotRaise.csnet10.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
attachAction<EventHandler>detachAction<EventHandler>actionFunc<ValueTask>messagestring?actionExpressionstring?
Returns
No documentation is available.
DoesNotRaiseAny<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Action, string?, string?)
Assert.DoesNotRaise.cspublic static void DoesNotRaiseAny<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Action action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgsType parameters
TEventArgs
Parameters
attachAction<EventHandler<TEventArgs>>detachAction<EventHandler<TEventArgs>>actionActionmessagestring?actionExpressionstring?
No documentation is available.
DoesNotRaiseAny<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<Task>, string?, string?)
Assert.DoesNotRaise.csnet10.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 : EventArgsnet11.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 : EventArgsType parameters
TEventArgs
Parameters
attachAction<EventHandler<TEventArgs>>detachAction<EventHandler<TEventArgs>>actionFunc<Task>messagestring?actionExpressionstring?
Returns
No documentation is available.
DoesNotRaiseAny<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<ValueTask>, string?, string?)
Assert.DoesNotRaise.csnet10.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 : EventArgsnet11.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 : EventArgsType parameters
TEventArgs
Parameters
attachAction<EventHandler<TEventArgs>>detachAction<EventHandler<TEventArgs>>actionFunc<ValueTask>messagestring?actionExpressionstring?
Returns
No documentation is available.
DoesNotStartWith overloads
DoesNotStartWith(char, string?, IEqualityComparer<char>?, string?, string?, string?)
Assert.DoesNotStartWith.csDoesNotStartWith(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)
Assert.DoesNotStartWith.cspublic static void DoesNotStartWith(IEnumerable expected, IEnumerable? actual, IEqualityComparer? comparer = null, string? message = null, string? actualExpression = null, string? expectedExpression = null)Parameters
expectedIEnumerableactualIEnumerable?comparerIEqualityComparer?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotStartWith(object?, IEnumerable?, string?, string?, string?)
Assert.DoesNotStartWith.cspublic static void DoesNotStartWith(object? expected, IEnumerable? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)Parameters
expectedobject?actualIEnumerable?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotStartWith(ReadOnlySpan<char>, ReadOnlySpan<char>, bool, string?, string?, string?)
Assert.DoesNotStartWith.cspublic static void DoesNotStartWith(ReadOnlySpan<char> expected, ReadOnlySpan<char> actual, bool ignoreCase = false, string? message = null, string? actualExpression = null, string? expectedExpression = null)Parameters
expectedReadOnlySpan<char>actualReadOnlySpan<char>ignoreCaseboolmessagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotStartWith(ReadOnlySpan<char>, ReadOnlySpan<char>, StringComparison, string?, string?, string?)
Assert.DoesNotStartWith.cspublic static void DoesNotStartWith(ReadOnlySpan<char> expected, ReadOnlySpan<char> actual, StringComparison comparisonType, string? message = null, string? actualExpression = null, string? expectedExpression = null)Parameters
expectedReadOnlySpan<char>actualReadOnlySpan<char>comparisonTypeStringComparisonmessagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotStartWith(string, string?, bool, string?, string?, string?)
Assert.DoesNotStartWith.csDoesNotStartWith(string, string?, StringComparison, string?, string?, string?)
Assert.DoesNotStartWith.csDoesNotStartWith<T>(IEnumerable<T>, IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Assert.DoesNotStartWith.csnet10.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
expectedIEnumerable<T>actualIAsyncEnumerable<T>?comparerIEqualityComparer<T>?messagestring?actualExpressionstring?expectedExpressionstring?
Returns
No documentation is available.
DoesNotStartWith<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Assert.DoesNotStartWith.cspublic 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
expectedIEnumerable<T>actualIEnumerable<T>?comparerIEqualityComparer<T>?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotStartWith<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)
Assert.DoesNotStartWith.cspublic 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
expectedReadOnlySpan<T>actualReadOnlySpan<T>comparerIEqualityComparer<T>?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotStartWith<T>(T, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Assert.DoesNotStartWith.cspublic 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
expectedTactualIEnumerable<T>?comparerIEqualityComparer<T>?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotStartWith<T>(T, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)
Assert.DoesNotStartWith.cspublic 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
expectedTactualReadOnlySpan<T>comparerIEqualityComparer<T>?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotStartWith<T>(T, T[]?, IEqualityComparer<T>?, string?, string?, string?)
Assert.DoesNotStartWith.cspublic 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
expectedTactualT[]?comparerIEqualityComparer<T>?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
DoesNotThrow overloads
DoesNotThrow(Action, string?, string?)
Assert.DoesNotThrow.csDoesNotThrow(Func<object?>, string?, string?)
Assert.DoesNotThrow.csDoesNotThrow(Func<Task>, string?, string?)
Assert.DoesNotThrow.csDoesNotThrow(Func<ValueTask>, string?, string?)
Assert.DoesNotThrow.csDoesNotThrow(Type, Action, string?, string?)
Assert.DoesNotThrow.csDoesNotThrow(Type, Func<object?>, string?, string?)
Assert.DoesNotThrow.csDoesNotThrow(Type, Func<Task>, string?, string?)
Assert.DoesNotThrow.csDoesNotThrow(Type, Func<ValueTask>, string?, string?)
Assert.DoesNotThrow.csnet10.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)No documentation is available.
DoesNotThrow<T>(Action, string?, string?)
Assert.DoesNotThrow.csDoesNotThrow<T>(Func<object?>, string?, string?)
Assert.DoesNotThrow.csDoesNotThrow<T>(Func<Task>, string?, string?)
Assert.DoesNotThrow.csnet10.0
public static Task DoesNotThrow<T>(Func<Task> action, string? message = null, string? actionExpression = null) where T : Exceptionnet11.0
public static Task DoesNotThrow<T>(Func<Task> action, string? message = null, string? actionExpression = null) where T : ExceptionNo documentation is available.
DoesNotThrow<T>(Func<ValueTask>, string?, string?)
Assert.DoesNotThrow.csnet10.0
public static Task DoesNotThrow<T>(Func<ValueTask> action, string? message = null, string? actionExpression = null) where T : Exceptionnet11.0
public static Task DoesNotThrow<T>(Func<ValueTask> action, string? message = null, string? actionExpression = null) where T : ExceptionNo documentation is available.
DoesNotThrowAny overloads
DoesNotThrowAny(Type, Action, string?, string?)
Assert.DoesNotThrow.csDoesNotThrowAny(Type, Func<object?>, string?, string?)
Assert.DoesNotThrow.csDoesNotThrowAny(Type, Func<Task>, string?, string?)
Assert.DoesNotThrow.csnet10.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)No documentation is available.
DoesNotThrowAny(Type, Func<ValueTask>, string?, string?)
Assert.DoesNotThrow.csnet10.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)No documentation is available.
DoesNotThrowAny<T>(Action, string?, string?)
Assert.DoesNotThrow.csDoesNotThrowAny<T>(Func<object?>, string?, string?)
Assert.DoesNotThrow.csDoesNotThrowAny<T>(Func<Task>, string?, string?)
Assert.DoesNotThrow.csnet10.0
public static Task DoesNotThrowAny<T>(Func<Task> action, string? message = null, string? actionExpression = null) where T : Exceptionnet11.0
public static Task DoesNotThrowAny<T>(Func<Task> action, string? message = null, string? actionExpression = null) where T : ExceptionNo documentation is available.
DoesNotThrowAny<T>(Func<ValueTask>, string?, string?)
Assert.DoesNotThrow.csnet10.0
public static Task DoesNotThrowAny<T>(Func<ValueTask> action, string? message = null, string? actionExpression = null) where T : Exceptionnet11.0
public static Task DoesNotThrowAny<T>(Func<ValueTask> action, string? message = null, string? actionExpression = null) where T : ExceptionNo documentation is available.
Empty overloads
Empty(IEnumerable?, string?, string?)
Assert.Empty.csAsserts that a non-generic enumerable is not null and is empty.
public static void Empty(IEnumerable? actual, string? message = null, string? actualExpression = null)Parameters
actualIEnumerable?- The enumerable to inspect.
messagestring?actualExpressionstring?- The expression that produced the actual value.
Empty(string?, string?, string?)
Assert.Empty.csEmpty<T>(IAsyncEnumerable<T>?, string?, string?)
Assert.Empty.csAsserts 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
actualIAsyncEnumerable<T>?- The sequence to inspect.
messagestring?actualExpressionstring?- The expression that produced the actual value.
Returns
Empty<T>(IEnumerable<T>?, string?, string?)
Assert.Empty.csAsserts 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
actualIEnumerable<T>?- The enumerable to inspect.
messagestring?actualExpressionstring?- The expression that produced the actual value.
Empty<T>(ReadOnlySpan<T>, string?, string?)
Assert.Empty.csAsserts that a span is empty.
public static void Empty<T>(ReadOnlySpan<T> actual, string? message = null, string? actualExpression = null)Type parameters
T
Parameters
actualReadOnlySpan<T>- The span to inspect.
messagestring?actualExpressionstring?- The expression that produced the actual value.
Empty<T>(T[]?, string?, string?)
Assert.Empty.csAsserts that an array is not null and is empty.
Type parameters
T
Parameters
actualT[]?- The array to inspect.
messagestring?actualExpressionstring?- 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.csAsserts 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
expectedchar- The character expected at the end of
actual. actualstring?- The string to inspect.
comparerIEqualityComparer<char>?- The comparer used to compare characters.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
EndsWith(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)
Assert.EndsWith.csAsserts 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
expectedIEnumerable- The suffix expected at the end of
actual. Withoutcomparer, the assertion also succeeds whenexpectedis itself the last item ofactual. A string is compared as an item, unlessactualis a sequence of characters. actualIEnumerable?- The enumerable to inspect.
comparerIEqualityComparer?- The comparer used to compare values.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
EndsWith(object?, IEnumerable?, string?, string?, string?)
Assert.EndsWith.csAsserts 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
expectedobject?- The value expected at the end of
actual. A string compared to a sequence of characters is compared as a suffix. actualIEnumerable?- The enumerable to inspect.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
EndsWith(ReadOnlySpan<char>, ReadOnlySpan<char>, bool, string?, string?, string?)
Assert.EndsWith.csAsserts 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
expectedReadOnlySpan<char>- The suffix expected at the end of
actual. actualReadOnlySpan<char>- The span to inspect.
ignoreCasebool- When
true, the comparison ignores casing (OrdinalIgnoreCase); otherwise, it is case-sensitive (Ordinal). messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
EndsWith(ReadOnlySpan<char>, ReadOnlySpan<char>, StringComparison, string?, string?, string?)
Assert.EndsWith.csAsserts 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
expectedReadOnlySpan<char>- The suffix expected at the end of
actual. actualReadOnlySpan<char>- The span to inspect.
comparisonTypeStringComparison- The comparison used to compare
expectedwith the end ofactual. messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
EndsWith(string, string?, bool, string?, string?, string?)
Assert.EndsWith.csAsserts 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
expectedstring- The suffix expected at the end of
actual. actualstring?- The string to inspect.
ignoreCasebool- When
true, the comparison ignores casing (OrdinalIgnoreCase); otherwise, it is case-sensitive (Ordinal). messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
EndsWith(string, string?, StringComparison, string?, string?, string?)
Assert.EndsWith.csAsserts 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
expectedstring- The suffix expected at the end of
actual. actualstring?- The string to inspect.
comparisonTypeStringComparison- The comparison used to compare
expectedwith the end ofactual. messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
EndsWith<T>(IEnumerable<T>, IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Assert.EndsWith.csAsserts 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
expectedIEnumerable<T>- The suffix expected at the end of
actual. Whenexpectedis itself the last item ofactual, the assertion also succeeds. actualIAsyncEnumerable<T>?- The sequence to inspect.
comparerIEqualityComparer<T>?- The comparer used to compare values.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
Returns
EndsWith<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Assert.EndsWith.csAsserts 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
expectedIEnumerable<T>- The suffix expected at the end of
actual. Whenexpectedis itself the last item ofactual, the assertion also succeeds. actualIEnumerable<T>?- The enumerable to inspect.
comparerIEqualityComparer<T>?- The comparer used to compare values.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
EndsWith<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)
Assert.EndsWith.csAsserts 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
expectedReadOnlySpan<T>- The suffix expected at the end of
actual. actualReadOnlySpan<T>- The span to inspect.
comparerIEqualityComparer<T>?- The comparer used to compare values.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
EndsWith<T>(T, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Assert.EndsWith.csAsserts 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
expectedT- The value expected at the end of
actual. actualIEnumerable<T>?- The enumerable to inspect.
comparerIEqualityComparer<T>?- The comparer used to compare values.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
EndsWith<T>(T, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)
Assert.EndsWith.csAsserts 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
expectedT- The value expected at the end of
actual. actualReadOnlySpan<T>- The span to inspect.
comparerIEqualityComparer<T>?- The comparer used to compare values.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
EndsWith<T>(T, T[]?, IEqualityComparer<T>?, string?, string?, string?)
Assert.EndsWith.csAsserts 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
expectedT- The value expected at the end of
actual. actualT[]?- The array to inspect.
comparerIEqualityComparer<T>?- The comparer used to compare values.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
Equal overloads
Equal(IEnumerable?, IEnumerable?, IEqualityComparer?, string?, string?, string?)
Assert.Equal.cspublic static void Equal(IEnumerable? expected, IEnumerable? actual, IEqualityComparer? comparer, string? message = null, string? actualExpression = null, string? expectedExpression = null)Parameters
expectedIEnumerable?actualIEnumerable?comparerIEqualityComparer?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
Equal(IEnumerable?, IEnumerable?, string?, string?, string?)
Assert.Equal.cspublic static void Equal(IEnumerable? expected, IEnumerable? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)Parameters
expectedIEnumerable?actualIEnumerable?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
Equal(DateTime, DateTime, TimeSpan, string?, string?, string?)
Assert.Equal.csEqual(DateTimeOffset, DateTimeOffset, TimeSpan, string?, string?, string?)
Assert.Equal.cspublic static void Equal(DateTimeOffset expected, DateTimeOffset actual, TimeSpan precision, string? message = null, string? actualExpression = null, string? expectedExpression = null)Parameters
expectedDateTimeOffsetactualDateTimeOffsetprecisionTimeSpanmessagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
Equal(decimal, decimal, decimal, string?, string?, string?)
Assert.Equal.csEqual(decimal, decimal, int, MidpointRounding, string?, string?, string?)
Assert.Equal.csEqual(decimal, decimal, int, string?, string?, string?)
Assert.Equal.csEqual(double, double, double, string?, string?, string?)
Assert.Equal.csEqual(double, double, int, MidpointRounding, string?, string?, string?)
Assert.Equal.csEqual(double, double, int, string?, string?, string?)
Assert.Equal.csEqual(Half, Half, Half, string?, string?, string?)
Assert.Equal.csEqual(object?, object?, string?, string?, string?)
Assert.Equal.csEqual(ReadOnlySpan<char>, ReadOnlySpan<char>, bool, bool, string?, string?, string?)
Assert.Equal.cspublic 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
expectedReadOnlySpan<char>actualReadOnlySpan<char>ignoreCaseboolignoreLineEndingDifferencesboolmessagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
Equal(float, float, int, MidpointRounding, string?, string?, string?)
Assert.Equal.csEqual(float, float, int, string?, string?, string?)
Assert.Equal.csEqual(float, float, float, string?, string?, string?)
Assert.Equal.csEqual(string?, string?, bool, bool, string?, string?, string?)
Assert.Equal.csEqual<T>(IAsyncEnumerable<T>?, IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Assert.Equal.csnet10.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
expectedIAsyncEnumerable<T>?actualIAsyncEnumerable<T>?comparerIEqualityComparer<T>?messagestring?actualExpressionstring?expectedExpressionstring?
Returns
No documentation is available.
Equal<T>(IAsyncEnumerable<T>?, IAsyncEnumerable<T>?, string?, string?, string?)
Assert.Equal.csnet10.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
expectedIAsyncEnumerable<T>?actualIAsyncEnumerable<T>?messagestring?actualExpressionstring?expectedExpressionstring?
Returns
No documentation is available.
Equal<T>(IAsyncEnumerable<T>?, IEnumerable<T>?, string?, string?, string?)
Assert.Equal.csnet10.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
expectedIAsyncEnumerable<T>?actualIEnumerable<T>?messagestring?actualExpressionstring?expectedExpressionstring?
Returns
No documentation is available.
Equal<T>(IEnumerable<T>?, IAsyncEnumerable<T>?, string?, string?, string?)
Assert.Equal.csnet10.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
expectedIEnumerable<T>?actualIAsyncEnumerable<T>?messagestring?actualExpressionstring?expectedExpressionstring?
Returns
No documentation is available.
Equal<T>(IEnumerable<T>?, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Assert.Equal.cspublic 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
expectedIEnumerable<T>?actualIEnumerable<T>?comparerIEqualityComparer<T>?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
Equal<T>(IEnumerable<T>?, IEnumerable<T>?, string?, string?, string?)
Assert.Equal.cspublic static void Equal<T>(IEnumerable<T>? expected, IEnumerable<T>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)Type parameters
T
Parameters
expectedIEnumerable<T>?actualIEnumerable<T>?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
Equal<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, string?, string?, string?)
Assert.Equal.cspublic static void Equal<T>(ReadOnlySpan<T> expected, ReadOnlySpan<T> actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)Type parameters
T
Parameters
expectedReadOnlySpan<T>actualReadOnlySpan<T>messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
Equal<T>(T, T, IEqualityComparer<T>?, string?, string?, string?)
Assert.Equal.csVerifies 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
expectedTactualTcomparerIEqualityComparer<T>?messagestring?actualExpressionstring?expectedExpressionstring?
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.csEqual<T>(T, T, T, string?, string?, string?)
Assert.Equal.cspublic 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
No documentation is available.
Equal<T>(T, T, string?, string?, string?)
Assert.Equal.csVerifies 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 structType parameters
T
Parameters
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.csEqual<TExpected, TActual>(IAsyncEnumerable<TExpected>?, IAsyncEnumerable<TActual>?, string?, string?, string?)
Assert.Equal.csnet10.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
TExpectedTActual
Parameters
expectedIAsyncEnumerable<TExpected>?actualIAsyncEnumerable<TActual>?messagestring?actualExpressionstring?expectedExpressionstring?
Returns
No documentation is available.
Equal<TExpected, TActual>(IEnumerable<TExpected>?, IEnumerable<TActual>?, string?, string?, string?)
Assert.Equal.cspublic static void Equal<TExpected, TActual>(IEnumerable<TExpected>? expected, IEnumerable<TActual>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)Type parameters
TExpectedTActual
Parameters
expectedIEnumerable<TExpected>?actualIEnumerable<TActual>?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
Equal<TExpected, TActual>(ReadOnlyMemory<TExpected>, ReadOnlyMemory<TActual>, string?, string?, string?)
Assert.Equal.cspublic static void Equal<TExpected, TActual>(ReadOnlyMemory<TExpected> expected, ReadOnlyMemory<TActual> actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)Type parameters
TExpectedTActual
Parameters
expectedReadOnlyMemory<TExpected>actualReadOnlyMemory<TActual>messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
Equal<TExpected, TActual>(ReadOnlySpan<TExpected>, ReadOnlySpan<TActual>, string?, string?, string?)
Assert.Equal.cspublic static void Equal<TExpected, TActual>(ReadOnlySpan<TExpected> expected, ReadOnlySpan<TActual> actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)Type parameters
TExpectedTActual
Parameters
expectedReadOnlySpan<TExpected>actualReadOnlySpan<TActual>messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
EqualUnordered overloads
EqualUnordered(IEnumerable?, IEnumerable?, IEqualityComparer?, string?, string?, string?)
Assert.EqualUnordered.cspublic static void EqualUnordered(IEnumerable? expected, IEnumerable? actual, IEqualityComparer? comparer, string? message = null, string? actualExpression = null, string? expectedExpression = null)Parameters
expectedIEnumerable?actualIEnumerable?comparerIEqualityComparer?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
EqualUnordered(IEnumerable?, IEnumerable?, string?, string?, string?)
Assert.EqualUnordered.cspublic static void EqualUnordered(IEnumerable? expected, IEnumerable? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)Parameters
expectedIEnumerable?actualIEnumerable?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
EqualUnordered<T>(IAsyncEnumerable<T>?, IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Assert.EqualUnordered.csAsserts 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
expectedIAsyncEnumerable<T>?actualIAsyncEnumerable<T>?comparerIEqualityComparer<T>?- The comparer used to compare items. When
null, items are compared likeAssert.Equalcompares two values. messagestring?actualExpressionstring?expectedExpressionstring?
Returns
EqualUnordered<T>(IAsyncEnumerable<T>?, IAsyncEnumerable<T>?, string?, string?, string?)
Assert.EqualUnordered.csAsserts 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
expectedIAsyncEnumerable<T>?actualIAsyncEnumerable<T>?messagestring?actualExpressionstring?expectedExpressionstring?
Returns
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.csAsserts 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
expectedIEnumerable<T>?actualIEnumerable<T>?comparerIEqualityComparer<T>?- The comparer used to compare items. When
null, items are compared likeAssert.Equalcompares two values. messagestring?actualExpressionstring?expectedExpressionstring?
EqualUnordered<T>(IEnumerable<T>?, IEnumerable<T>?, string?, string?, string?)
Assert.EqualUnordered.csAsserts 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
expectedIEnumerable<T>?actualIEnumerable<T>?messagestring?actualExpressionstring?expectedExpressionstring?
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.csnet10.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
TExpectedTActual
Parameters
expectedIAsyncEnumerable<TExpected>?actualIAsyncEnumerable<TActual>?messagestring?actualExpressionstring?expectedExpressionstring?
Returns
No documentation is available.
EqualUnordered<TExpected, TActual>(IEnumerable<TExpected>?, IEnumerable<TActual>?, string?, string?, string?)
Assert.EqualUnordered.cspublic static void EqualUnordered<TExpected, TActual>(IEnumerable<TExpected>? expected, IEnumerable<TActual>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)Type parameters
TExpectedTActual
Parameters
expectedIEnumerable<TExpected>?actualIEnumerable<TActual>?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
Equals(object?, object?)
Assert.cs- Obsolete: This is an override of Object.Equals(). Use Assert.Equal() instead.
Equivalent overloads
Equivalent(object?, object?, EquivalentOptions?, string?, string?, string?)
Assert.Equivalent.csEquivalent(object?, object?, string?, string?, string?)
Assert.Equivalent.csFail(string?)
Assert.csFalse overloads
False(bool, string?, string?)
Assert.False.csAsserts that a condition is false. If the condition is true, an AssertionException is thrown.
False(bool?, string?, string?)
Assert.False.csAsserts that a nullable condition is false. If the condition is true or null, an AssertionException is thrown.
HasCount overloads
HasCount(int, IEnumerable?, string?, string?)
Assert.Count.cspublic static void HasCount(int expectedCount, IEnumerable? actual, string? message = null, string? actualExpression = null)Parameters
expectedCountintactualIEnumerable?messagestring?actualExpressionstring?
No documentation is available.
HasCount(int, string?, string?, string?)
Assert.Count.csHasCount<T>(int, IAsyncEnumerable<T>?, string?, string?)
Assert.Count.csnet10.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
expectedCountintactualIAsyncEnumerable<T>?messagestring?actualExpressionstring?
Returns
No documentation is available.
HasCount<T>(int, IEnumerable<T>?, string?, string?)
Assert.Count.cspublic static void HasCount<T>(int expectedCount, IEnumerable<T>? actual, string? message = null, string? actualExpression = null)Type parameters
T
Parameters
expectedCountintactualIEnumerable<T>?messagestring?actualExpressionstring?
No documentation is available.
HasCount<T>(int, ReadOnlySpan<T>, string?, string?)
Assert.Count.cspublic static void HasCount<T>(int expectedCount, ReadOnlySpan<T> actual, string? message = null, string? actualExpression = null)Type parameters
T
Parameters
expectedCountintactualReadOnlySpan<T>messagestring?actualExpressionstring?
No documentation is available.
HasCount<T>(int, T[]?, string?, string?)
Assert.Count.csHasCountGreaterThan overloads
HasCountGreaterThan(int, IEnumerable?, string?, string?)
Assert.Count.cspublic static void HasCountGreaterThan(int expectedCount, IEnumerable? actual, string? message = null, string? actualExpression = null)Parameters
expectedCountintactualIEnumerable?messagestring?actualExpressionstring?
No documentation is available.
HasCountGreaterThan(int, string?, string?, string?)
Assert.Count.csHasCountGreaterThan<T>(int, IAsyncEnumerable<T>?, string?, string?)
Assert.Count.csnet10.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
expectedCountintactualIAsyncEnumerable<T>?messagestring?actualExpressionstring?
Returns
No documentation is available.
HasCountGreaterThan<T>(int, IEnumerable<T>?, string?, string?)
Assert.Count.cspublic static void HasCountGreaterThan<T>(int expectedCount, IEnumerable<T>? actual, string? message = null, string? actualExpression = null)Type parameters
T
Parameters
expectedCountintactualIEnumerable<T>?messagestring?actualExpressionstring?
No documentation is available.
HasCountGreaterThan<T>(int, ReadOnlySpan<T>, string?, string?)
Assert.Count.cspublic static void HasCountGreaterThan<T>(int expectedCount, ReadOnlySpan<T> actual, string? message = null, string? actualExpression = null)Type parameters
T
Parameters
expectedCountintactualReadOnlySpan<T>messagestring?actualExpressionstring?
No documentation is available.
HasCountGreaterThan<T>(int, T[]?, string?, string?)
Assert.Count.csHasCountGreaterThanOrEqual overloads
HasCountGreaterThanOrEqual(int, IEnumerable?, string?, string?)
Assert.Count.cspublic static void HasCountGreaterThanOrEqual(int expectedCount, IEnumerable? actual, string? message = null, string? actualExpression = null)Parameters
expectedCountintactualIEnumerable?messagestring?actualExpressionstring?
No documentation is available.
HasCountGreaterThanOrEqual(int, string?, string?, string?)
Assert.Count.csHasCountGreaterThanOrEqual<T>(int, IAsyncEnumerable<T>?, string?, string?)
Assert.Count.csnet10.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
expectedCountintactualIAsyncEnumerable<T>?messagestring?actualExpressionstring?
Returns
No documentation is available.
HasCountGreaterThanOrEqual<T>(int, IEnumerable<T>?, string?, string?)
Assert.Count.cspublic static void HasCountGreaterThanOrEqual<T>(int expectedCount, IEnumerable<T>? actual, string? message = null, string? actualExpression = null)Type parameters
T
Parameters
expectedCountintactualIEnumerable<T>?messagestring?actualExpressionstring?
No documentation is available.
HasCountGreaterThanOrEqual<T>(int, ReadOnlySpan<T>, string?, string?)
Assert.Count.cspublic static void HasCountGreaterThanOrEqual<T>(int expectedCount, ReadOnlySpan<T> actual, string? message = null, string? actualExpression = null)Type parameters
T
Parameters
expectedCountintactualReadOnlySpan<T>messagestring?actualExpressionstring?
No documentation is available.
HasCountGreaterThanOrEqual<T>(int, T[]?, string?, string?)
Assert.Count.csHasCountLessThan overloads
HasCountLessThan(int, IEnumerable?, string?, string?)
Assert.Count.cspublic static void HasCountLessThan(int expectedCount, IEnumerable? actual, string? message = null, string? actualExpression = null)Parameters
expectedCountintactualIEnumerable?messagestring?actualExpressionstring?
No documentation is available.
HasCountLessThan(int, string?, string?, string?)
Assert.Count.csHasCountLessThan<T>(int, IAsyncEnumerable<T>?, string?, string?)
Assert.Count.csnet10.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
expectedCountintactualIAsyncEnumerable<T>?messagestring?actualExpressionstring?
Returns
No documentation is available.
HasCountLessThan<T>(int, IEnumerable<T>?, string?, string?)
Assert.Count.cspublic static void HasCountLessThan<T>(int expectedCount, IEnumerable<T>? actual, string? message = null, string? actualExpression = null)Type parameters
T
Parameters
expectedCountintactualIEnumerable<T>?messagestring?actualExpressionstring?
No documentation is available.
HasCountLessThan<T>(int, ReadOnlySpan<T>, string?, string?)
Assert.Count.cspublic static void HasCountLessThan<T>(int expectedCount, ReadOnlySpan<T> actual, string? message = null, string? actualExpression = null)Type parameters
T
Parameters
expectedCountintactualReadOnlySpan<T>messagestring?actualExpressionstring?
No documentation is available.
HasCountLessThan<T>(int, T[]?, string?, string?)
Assert.Count.csHasCountLessThanOrEqual overloads
HasCountLessThanOrEqual(int, IEnumerable?, string?, string?)
Assert.Count.cspublic static void HasCountLessThanOrEqual(int expectedCount, IEnumerable? actual, string? message = null, string? actualExpression = null)Parameters
expectedCountintactualIEnumerable?messagestring?actualExpressionstring?
No documentation is available.
HasCountLessThanOrEqual(int, string?, string?, string?)
Assert.Count.csHasCountLessThanOrEqual<T>(int, IAsyncEnumerable<T>?, string?, string?)
Assert.Count.csnet10.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
expectedCountintactualIAsyncEnumerable<T>?messagestring?actualExpressionstring?
Returns
No documentation is available.
HasCountLessThanOrEqual<T>(int, IEnumerable<T>?, string?, string?)
Assert.Count.cspublic static void HasCountLessThanOrEqual<T>(int expectedCount, IEnumerable<T>? actual, string? message = null, string? actualExpression = null)Type parameters
T
Parameters
expectedCountintactualIEnumerable<T>?messagestring?actualExpressionstring?
No documentation is available.
HasCountLessThanOrEqual<T>(int, ReadOnlySpan<T>, string?, string?)
Assert.Count.cspublic static void HasCountLessThanOrEqual<T>(int expectedCount, ReadOnlySpan<T> actual, string? message = null, string? actualExpression = null)Type parameters
T
Parameters
expectedCountintactualReadOnlySpan<T>messagestring?actualExpressionstring?
No documentation is available.
HasCountLessThanOrEqual<T>(int, T[]?, string?, string?)
Assert.Count.csInRange overloads
InRange<T>(T, T, T, IComparer<T>?, string?, string?)
Assert.InRange.csAsserts 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
actualT- The value to inspect.
lowT- The inclusive lower bound.
highT- The inclusive upper bound.
comparerIComparer<T>?- The comparer used to order values.
messagestring?actualExpressionstring?- 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.csAsserts 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 structType parameters
T
Parameters
actualT- The value to inspect.
lowT- The inclusive lower bound.
highT- The inclusive upper bound.
messagestring?actualExpressionstring?- The expression that produced the actual value.
lowExpressionstring?- The expression that produced the lower bound.
highExpressionstring?- 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.csIsAssignableTo<T>(object?, string?, string?)
Assert.Type.csIsNotAssignableTo overloads
IsNotAssignableTo(Type, object?, string?, string?)
Assert.NotType.csIsNotAssignableTo<T>(object?, string?, string?)
Assert.NotType.csIsNotType overloads
IsNotType(Type, object?, string?, string?)
Assert.NotType.csIsNotType<T>(object?, string?, string?)
Assert.NotType.csIsType overloads
IsType(Type, object?, string?, string?)
Assert.Type.csIsType<T>(object?, string?, string?)
Assert.Type.csAsserts that an object is exactly of the specified type.
Matches overloads
Matches(string, string, string?, string?, string?)
Assert.Matches.csAsserts 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
patternstring- The regular expression pattern expected to match
actual. actualstring- The string to inspect.
messagestring?actualExpressionstring?- The expression that produced the actual value.
patternExpressionstring?- 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.csNotDistinct overloads
NotDistinct(IEnumerable?, IEqualityComparer?, string?, string?)
Assert.NotDistinct.cspublic static void NotDistinct(IEnumerable? actual, IEqualityComparer? comparer = null, string? message = null, string? actualExpression = null)Parameters
actualIEnumerable?comparerIEqualityComparer?messagestring?actualExpressionstring?
No documentation is available.
NotDistinct(string?, string?, string?)
Assert.NotDistinct.csNotDistinct<T>(IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?)
Assert.NotDistinct.csnet10.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
actualIAsyncEnumerable<T>?comparerIEqualityComparer<T>?messagestring?actualExpressionstring?
Returns
No documentation is available.
NotDistinct<T>(IEnumerable<T>?, IEqualityComparer<T>?, string?, string?)
Assert.NotDistinct.cspublic static void NotDistinct<T>(IEnumerable<T>? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null)Type parameters
T
Parameters
actualIEnumerable<T>?comparerIEqualityComparer<T>?messagestring?actualExpressionstring?
No documentation is available.
NotDistinct<T>(ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?)
Assert.NotDistinct.cspublic static void NotDistinct<T>(ReadOnlySpan<T> actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null)Type parameters
T
Parameters
actualReadOnlySpan<T>comparerIEqualityComparer<T>?messagestring?actualExpressionstring?
No documentation is available.
NotDistinct<T>(T[]?, IEqualityComparer<T>?, string?, string?)
Assert.NotDistinct.cspublic static void NotDistinct<T>(T[]? actual, IEqualityComparer<T>? comparer = null, string? message = null, string? actualExpression = null)Type parameters
T
Parameters
actualT[]?comparerIEqualityComparer<T>?messagestring?actualExpressionstring?
No documentation is available.
NotEmpty overloads
NotEmpty(IEnumerable?, string?, string?)
Assert.NotEmpty.cspublic static void NotEmpty(IEnumerable? actual, string? message = null, string? actualExpression = null)Parameters
actualIEnumerable?messagestring?actualExpressionstring?
No documentation is available.
NotEmpty(string?, string?, string?)
Assert.NotEmpty.csNotEmpty<T>(IAsyncEnumerable<T>?, string?, string?)
Assert.NotEmpty.csnet10.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)No documentation is available.
NotEmpty<T>(IEnumerable<T>?, string?, string?)
Assert.NotEmpty.cspublic static void NotEmpty<T>(IEnumerable<T>? actual, string? message = null, string? actualExpression = null)No documentation is available.
NotEmpty<T>(ReadOnlySpan<T>, string?, string?)
Assert.NotEmpty.cspublic static void NotEmpty<T>(ReadOnlySpan<T> actual, string? message = null, string? actualExpression = null)No documentation is available.
NotEmpty<T>(T[]?, string?, string?)
Assert.NotEmpty.csNotEqual overloads
NotEqual(IEnumerable?, IEnumerable?, IEqualityComparer?, string?, string?, string?)
Assert.NotEqual.cspublic static void NotEqual(IEnumerable? expected, IEnumerable? actual, IEqualityComparer? comparer, string? message = null, string? actualExpression = null, string? expectedExpression = null)Parameters
expectedIEnumerable?actualIEnumerable?comparerIEqualityComparer?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
NotEqual(IEnumerable?, IEnumerable?, string?, string?, string?)
Assert.NotEqual.cspublic static void NotEqual(IEnumerable? expected, IEnumerable? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)Parameters
expectedIEnumerable?actualIEnumerable?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
NotEqual(DateTime, DateTime, TimeSpan, string?, string?, string?)
Assert.NotEqual.csNotEqual(DateTimeOffset, DateTimeOffset, TimeSpan, string?, string?, string?)
Assert.NotEqual.cspublic static void NotEqual(DateTimeOffset expected, DateTimeOffset actual, TimeSpan precision, string? message = null, string? actualExpression = null, string? expectedExpression = null)Parameters
expectedDateTimeOffsetactualDateTimeOffsetprecisionTimeSpanmessagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
NotEqual(decimal, decimal, decimal, string?, string?, string?)
Assert.NotEqual.csNotEqual(decimal, decimal, int, MidpointRounding, string?, string?, string?)
Assert.NotEqual.csNotEqual(decimal, decimal, int, string?, string?, string?)
Assert.NotEqual.csNotEqual(double, double, double, string?, string?, string?)
Assert.NotEqual.csNotEqual(double, double, int, MidpointRounding, string?, string?, string?)
Assert.NotEqual.csNotEqual(double, double, int, string?, string?, string?)
Assert.NotEqual.csNotEqual(Half, Half, Half, string?, string?, string?)
Assert.NotEqual.csNotEqual(ReadOnlySpan<char>, ReadOnlySpan<char>, bool, bool, string?, string?, string?)
Assert.NotEqual.cspublic 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
expectedReadOnlySpan<char>actualReadOnlySpan<char>ignoreCaseboolignoreLineEndingDifferencesboolmessagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
NotEqual(float, float, int, MidpointRounding, string?, string?, string?)
Assert.NotEqual.csNotEqual(float, float, int, string?, string?, string?)
Assert.NotEqual.csNotEqual(float, float, float, string?, string?, string?)
Assert.NotEqual.csNotEqual(string?, string?, bool, bool, string?, string?, string?)
Assert.NotEqual.csNotEqual<T>(IAsyncEnumerable<T>?, IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Assert.NotEqual.csnet10.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
expectedIAsyncEnumerable<T>?actualIAsyncEnumerable<T>?comparerIEqualityComparer<T>?messagestring?actualExpressionstring?expectedExpressionstring?
Returns
No documentation is available.
NotEqual<T>(IAsyncEnumerable<T>?, IAsyncEnumerable<T>?, string?, string?, string?)
Assert.NotEqual.csnet10.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
expectedIAsyncEnumerable<T>?actualIAsyncEnumerable<T>?messagestring?actualExpressionstring?expectedExpressionstring?
Returns
No documentation is available.
NotEqual<T>(IEnumerable<T>?, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Assert.NotEqual.cspublic 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
expectedIEnumerable<T>?actualIEnumerable<T>?comparerIEqualityComparer<T>?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
NotEqual<T>(IEnumerable<T>?, IEnumerable<T>?, string?, string?, string?)
Assert.NotEqual.cspublic static void NotEqual<T>(IEnumerable<T>? expected, IEnumerable<T>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)Type parameters
T
Parameters
expectedIEnumerable<T>?actualIEnumerable<T>?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
NotEqual<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, string?, string?, string?)
Assert.NotEqual.cspublic static void NotEqual<T>(ReadOnlySpan<T> expected, ReadOnlySpan<T> actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)Type parameters
T
Parameters
expectedReadOnlySpan<T>actualReadOnlySpan<T>messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
NotEqual<T>(T, T, IEqualityComparer<T>?, string?, string?, string?)
Assert.NotEqual.csVerifies 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
expectedTactualTcomparerIEqualityComparer<T>?messagestring?actualExpressionstring?expectedExpressionstring?
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.csNotEqual<T>(T, T, T, string?, string?, string?)
Assert.NotEqual.cspublic 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
No documentation is available.
NotEqual<T>(T, T, string?, string?, string?)
Assert.NotEqual.csVerifies 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 structType parameters
T
Parameters
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.csnet10.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
TExpectedTActual
Parameters
expectedIAsyncEnumerable<TExpected>?actualIAsyncEnumerable<TActual>?messagestring?actualExpressionstring?expectedExpressionstring?
Returns
No documentation is available.
NotEqual<TExpected, TActual>(IEnumerable<TExpected>?, IEnumerable<TActual>?, string?, string?, string?)
Assert.NotEqual.cspublic static void NotEqual<TExpected, TActual>(IEnumerable<TExpected>? expected, IEnumerable<TActual>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)Type parameters
TExpectedTActual
Parameters
expectedIEnumerable<TExpected>?actualIEnumerable<TActual>?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
NotEqual<TExpected, TActual>(ReadOnlyMemory<TExpected>, ReadOnlyMemory<TActual>, string?, string?, string?)
Assert.NotEqual.cspublic static void NotEqual<TExpected, TActual>(ReadOnlyMemory<TExpected> expected, ReadOnlyMemory<TActual> actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)Type parameters
TExpectedTActual
Parameters
expectedReadOnlyMemory<TExpected>actualReadOnlyMemory<TActual>messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
NotEqual<TExpected, TActual>(ReadOnlySpan<TExpected>, ReadOnlySpan<TActual>, string?, string?, string?)
Assert.NotEqual.cspublic static void NotEqual<TExpected, TActual>(ReadOnlySpan<TExpected> expected, ReadOnlySpan<TActual> actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)Type parameters
TExpectedTActual
Parameters
expectedReadOnlySpan<TExpected>actualReadOnlySpan<TActual>messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
NotEqual<TExpected, TActual>(TExpected, TActual?, string?, string?, string?)
Assert.NotEqual.csNotEqualUnordered overloads
NotEqualUnordered(IEnumerable?, IEnumerable?, IEqualityComparer?, string?, string?, string?)
Assert.NotEqualUnordered.cspublic static void NotEqualUnordered(IEnumerable? expected, IEnumerable? actual, IEqualityComparer? comparer, string? message = null, string? actualExpression = null, string? expectedExpression = null)Parameters
expectedIEnumerable?actualIEnumerable?comparerIEqualityComparer?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
NotEqualUnordered(IEnumerable?, IEnumerable?, string?, string?, string?)
Assert.NotEqualUnordered.cspublic static void NotEqualUnordered(IEnumerable? expected, IEnumerable? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)Parameters
expectedIEnumerable?actualIEnumerable?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
NotEqualUnordered<T>(IAsyncEnumerable<T>?, IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Assert.NotEqualUnordered.csAsserts 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
expectedIAsyncEnumerable<T>?actualIAsyncEnumerable<T>?comparerIEqualityComparer<T>?- The comparer used to compare items. When
null, items are compared likeAssert.Equalcompares two values. messagestring?actualExpressionstring?expectedExpressionstring?
Returns
NotEqualUnordered<T>(IAsyncEnumerable<T>?, IAsyncEnumerable<T>?, string?, string?, string?)
Assert.NotEqualUnordered.csAsserts 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
expectedIAsyncEnumerable<T>?actualIAsyncEnumerable<T>?messagestring?actualExpressionstring?expectedExpressionstring?
Returns
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.csAsserts 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
expectedIEnumerable<T>?actualIEnumerable<T>?comparerIEqualityComparer<T>?- The comparer used to compare items. When
null, items are compared likeAssert.Equalcompares two values. messagestring?actualExpressionstring?expectedExpressionstring?
NotEqualUnordered<T>(IEnumerable<T>?, IEnumerable<T>?, string?, string?, string?)
Assert.NotEqualUnordered.csAsserts 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
expectedIEnumerable<T>?actualIEnumerable<T>?messagestring?actualExpressionstring?expectedExpressionstring?
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.csnet10.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
TExpectedTActual
Parameters
expectedIAsyncEnumerable<TExpected>?actualIAsyncEnumerable<TActual>?messagestring?actualExpressionstring?expectedExpressionstring?
Returns
No documentation is available.
NotEqualUnordered<TExpected, TActual>(IEnumerable<TExpected>?, IEnumerable<TActual>?, string?, string?, string?)
Assert.NotEqualUnordered.cspublic static void NotEqualUnordered<TExpected, TActual>(IEnumerable<TExpected>? expected, IEnumerable<TActual>? actual, string? message = null, string? actualExpression = null, string? expectedExpression = null)Type parameters
TExpectedTActual
Parameters
expectedIEnumerable<TExpected>?actualIEnumerable<TActual>?messagestring?actualExpressionstring?expectedExpressionstring?
No documentation is available.
NotEquivalent overloads
NotEquivalent(object?, object?, EquivalentOptions?, string?, string?, string?)
Assert.NotEquivalent.csNotEquivalent(object?, object?, string?, string?, string?)
Assert.NotEquivalent.csNotInRange overloads
NotInRange<T>(T, T, T, IComparer<T>?, string?, string?)
Assert.NotInRange.csNotInRange<T>(T, T, T, string?, string?, string?, string?)
Assert.NotInRange.csAsserts 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 structType parameters
T
Parameters
actualT- The value to inspect.
lowT- The inclusive lower bound.
highT- The inclusive upper bound.
messagestring?actualExpressionstring?- The expression that produced the actual value.
lowExpressionstring?- The expression that produced the lower bound.
highExpressionstring?- 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.csAsserts that a value is not null.
public static object NotNull(object? actual, string? message = null, string? actualExpression = null)Parameters
actualobject?- The value to inspect.
messagestring?actualExpressionstring?- 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.csNotNull<T>(T?, string?, string?)
Assert.NotNull.csNotProperSubset overloads
NotProperSubset(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)
Assert.NotSet.csAsserts 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
expectedSupersetIEnumerable- The collection
actualis compared to. actualIEnumerable?- The collection expected not to be a proper subset of
expectedSuperset. comparerIEqualityComparer?- The comparer used to compare values. When
nullandactualis a set, the set compares values itself, likeISet<T>.IsProperSubsetOf; otherwiseEqualityComparer<T>.Defaultis used. messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected superset.
NotProperSubset<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Assert.NotSet.csAsserts 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
expectedSupersetIEnumerable<T>- The collection
actualis compared to. actualIEnumerable<T>?- The collection expected not to be a proper subset of
expectedSuperset. comparerIEqualityComparer<T>?- The comparer used to compare values. When
nullandactualis a set, the set compares values itself, likeISet<T>.IsProperSubsetOf; otherwiseEqualityComparer<T>.Defaultis used. messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected superset.
NotProperSuperset overloads
NotProperSuperset(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)
Assert.NotSet.csAsserts 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
expectedSubsetIEnumerable- The collection
actualis compared to. actualIEnumerable?- The collection expected not to be a proper superset of
expectedSubset. comparerIEqualityComparer?- The comparer used to compare values. When
nullandactualis a set, the set compares values itself, likeISet<T>.IsProperSupersetOf; otherwiseEqualityComparer<T>.Defaultis used. messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected subset.
NotProperSuperset<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Assert.NotSet.csAsserts 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
expectedSubsetIEnumerable<T>- The collection
actualis compared to. actualIEnumerable<T>?- The collection expected not to be a proper superset of
expectedSubset. comparerIEqualityComparer<T>?- The comparer used to compare values. When
nullandactualis a set, the set compares values itself, likeISet<T>.IsProperSupersetOf; otherwiseEqualityComparer<T>.Defaultis used. messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected subset.
NotRaisedAny<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Action, string?, string?)
Assert.DoesNotRaise.csCompatibility 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 : EventArgsType parameters
TEventArgs
Parameters
attachAction<EventHandler<TEventArgs>>detachAction<EventHandler<TEventArgs>>actionActionmessagestring?actionExpressionstring?
NotRaisedAnyAsync<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<Task>, string?, string?)
Assert.DoesNotRaise.csCompatibility 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 : EventArgsnet11.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 : EventArgsType parameters
TEventArgs
Parameters
attachAction<EventHandler<TEventArgs>>detachAction<EventHandler<TEventArgs>>actionFunc<Task>messagestring?actionExpressionstring?
Returns
NotSame(object?, object?, string?, string?, string?)
Assert.NotSame.csNull overloads
Null(object?, string?, string?)
Assert.Null.csNull<T>(T?, string?, string?)
Assert.Null.csProperSubset overloads
ProperSubset(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)
Assert.Set.csAsserts 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
expectedSupersetIEnumerable- The collection expected to contain every unique item in
actualand at least one additional unique item. actualIEnumerable?- The collection expected to be a proper subset of
expectedSuperset. comparerIEqualityComparer?- The comparer used to compare values.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected superset.
ProperSubset<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Assert.Set.csAsserts 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
expectedSupersetIEnumerable<T>- The collection expected to contain every unique item in
actualand at least one additional unique item. actualIEnumerable<T>?- The collection expected to be a proper subset of
expectedSuperset. comparerIEqualityComparer<T>?- The comparer used to compare values. When
nullandactualis a set, the set compares values itself, likeISet<T>.IsProperSubsetOf; otherwiseEqualityComparer<T>.Defaultis used. messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected superset.
ProperSuperset overloads
ProperSuperset(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)
Assert.Set.csAsserts 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
expectedSubsetIEnumerable- The collection whose unique items are all expected in
actual, with at least one fewer unique item. actualIEnumerable?- The collection expected to be a proper superset of
expectedSubset. comparerIEqualityComparer?- The comparer used to compare values.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected subset.
ProperSuperset<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Assert.Set.csAsserts 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
expectedSubsetIEnumerable<T>- The collection whose unique items are all expected in
actual, with at least one fewer unique item. actualIEnumerable<T>?- The collection expected to be a proper superset of
expectedSubset. comparerIEqualityComparer<T>?- The comparer used to compare values. When
nullandactualis a set, the set compares values itself, likeISet<T>.IsProperSupersetOf; otherwiseEqualityComparer<T>.Defaultis used. messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected subset.
Raise overloads
Raise(Action<EventHandler>, Action<EventHandler>, Action, string?, string?)
Assert.Raise.cspublic static RaisedEvent<EventArgs> Raise(Action<EventHandler> attach, Action<EventHandler> detach, Action action, string? message = null, string? actionExpression = null)Parameters
attachAction<EventHandler>detachAction<EventHandler>actionActionmessagestring?actionExpressionstring?
Returns
No documentation is available.
Raise(Action<EventHandler>, Action<EventHandler>, Func<Task>, string?, string?)
Assert.Raise.csnet10.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
attachAction<EventHandler>detachAction<EventHandler>actionFunc<Task>messagestring?actionExpressionstring?
Returns
No documentation is available.
Raise(Action<EventHandler>, Action<EventHandler>, Func<ValueTask>, string?, string?)
Assert.Raise.csnet10.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)Parameters
attachAction<EventHandler>detachAction<EventHandler>actionFunc<ValueTask>messagestring?actionExpressionstring?
Returns
No documentation is available.
Raise<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Action, string?, string?)
Assert.Raise.cspublic static RaisedEvent<TEventArgs> Raise<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Action action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgsType parameters
TEventArgs
Parameters
attachAction<EventHandler<TEventArgs>>detachAction<EventHandler<TEventArgs>>actionActionmessagestring?actionExpressionstring?
Returns
No documentation is available.
Raise<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<Task>, string?, string?)
Assert.Raise.csnet10.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 : EventArgsnet11.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 : EventArgsType parameters
TEventArgs
Parameters
attachAction<EventHandler<TEventArgs>>detachAction<EventHandler<TEventArgs>>actionFunc<Task>messagestring?actionExpressionstring?
Returns
No documentation is available.
Raise<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<ValueTask>, string?, string?)
Assert.Raise.csnet10.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 : EventArgsnet11.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 : EventArgsType parameters
TEventArgs
Parameters
attachAction<EventHandler<TEventArgs>>detachAction<EventHandler<TEventArgs>>actionFunc<ValueTask>messagestring?actionExpressionstring?
Returns
No documentation is available.
RaiseAny overloads
RaiseAny(Action<EventHandler>, Action<EventHandler>, Action, string?, string?)
Assert.Raise.cspublic static RaisedEvent<EventArgs> RaiseAny(Action<EventHandler> attach, Action<EventHandler> detach, Action action, string? message = null, string? actionExpression = null)Parameters
attachAction<EventHandler>detachAction<EventHandler>actionActionmessagestring?actionExpressionstring?
Returns
No documentation is available.
RaiseAny(Action<EventHandler>, Action<EventHandler>, Func<Task>, string?, string?)
Assert.Raise.csnet10.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
attachAction<EventHandler>detachAction<EventHandler>actionFunc<Task>messagestring?actionExpressionstring?
Returns
No documentation is available.
RaiseAny(Action<EventHandler>, Action<EventHandler>, Func<ValueTask>, string?, string?)
Assert.Raise.csnet10.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)Parameters
attachAction<EventHandler>detachAction<EventHandler>actionFunc<ValueTask>messagestring?actionExpressionstring?
Returns
No documentation is available.
RaiseAny<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Action, string?, string?)
Assert.Raise.cspublic static RaisedEvent<TEventArgs> RaiseAny<TEventArgs>(Action<EventHandler<TEventArgs>> attach, Action<EventHandler<TEventArgs>> detach, Action action, string? message = null, string? actionExpression = null) where TEventArgs : EventArgsType parameters
TEventArgs
Parameters
attachAction<EventHandler<TEventArgs>>detachAction<EventHandler<TEventArgs>>actionActionmessagestring?actionExpressionstring?
Returns
No documentation is available.
RaiseAny<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<Task>, string?, string?)
Assert.Raise.csnet10.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 : EventArgsnet11.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 : EventArgsType parameters
TEventArgs
Parameters
attachAction<EventHandler<TEventArgs>>detachAction<EventHandler<TEventArgs>>actionFunc<Task>messagestring?actionExpressionstring?
Returns
No documentation is available.
RaiseAny<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<ValueTask>, string?, string?)
Assert.Raise.csnet10.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 : EventArgsnet11.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 : EventArgsType parameters
TEventArgs
Parameters
attachAction<EventHandler<TEventArgs>>detachAction<EventHandler<TEventArgs>>actionFunc<ValueTask>messagestring?actionExpressionstring?
Returns
No documentation is available.
Raises<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Action, string?, string?)
Assert.Raise.csCompatibility 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 : EventArgsType parameters
TEventArgs
Parameters
attachAction<EventHandler<TEventArgs>>detachAction<EventHandler<TEventArgs>>actionActionmessagestring?actionExpressionstring?
Returns
RaisesAny overloads
RaisesAny(Action<EventHandler>, Action<EventHandler>, Action, string?, string?)
Assert.Raise.csCompatibility 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
attachAction<EventHandler>detachAction<EventHandler>actionActionmessagestring?actionExpressionstring?
Returns
RaisesAny<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Action, string?, string?)
Assert.Raise.csCompatibility 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 : EventArgsType parameters
TEventArgs
Parameters
attachAction<EventHandler<TEventArgs>>detachAction<EventHandler<TEventArgs>>actionActionmessagestring?actionExpressionstring?
Returns
RaisesAnyAsync overloads
RaisesAnyAsync(Action<EventHandler>, Action<EventHandler>, Func<Task>, string?, string?)
Assert.Raise.csCompatibility 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
attachAction<EventHandler>detachAction<EventHandler>actionFunc<Task>messagestring?actionExpressionstring?
Returns
RaisesAnyAsync<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<Task>, string?, string?)
Assert.Raise.csCompatibility 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 : EventArgsnet11.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 : EventArgsType parameters
TEventArgs
Parameters
attachAction<EventHandler<TEventArgs>>detachAction<EventHandler<TEventArgs>>actionFunc<Task>messagestring?actionExpressionstring?
Returns
RaisesAsync<TEventArgs>(Action<EventHandler<TEventArgs>>, Action<EventHandler<TEventArgs>>, Func<Task>, string?, string?)
Assert.Raise.csCompatibility 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 : EventArgsnet11.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 : EventArgsType parameters
TEventArgs
Parameters
attachAction<EventHandler<TEventArgs>>detachAction<EventHandler<TEventArgs>>actionFunc<Task>messagestring?actionExpressionstring?
Returns
ReferenceEquals(object?, object?)
Assert.cs- Obsolete: This is an override of Object.ReferenceEquals(). Use Assert.Same() instead.
Same(object?, object?, string?, string?, string?)
Assert.Same.csSingle overloads
Single(IEnumerable?, string?, string?)
Assert.Single.csAsserts 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
actualIEnumerable?- The enumerable to inspect.
messagestring?actualExpressionstring?- The expression that produced the actual value.
Returns
Single(ReadOnlySpan<char>, string?, string?)
Assert.Single.csAsserts 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
actualReadOnlySpan<char>- The span to inspect.
messagestring?actualExpressionstring?- The expression that produced the actual value.
Returns
Single(string?, string?, string?)
Assert.Single.csAsserts that a string contains a single character and returns it.
Single<T>(IAsyncEnumerable<T>?, string?, string?)
Assert.Single.csAsserts 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
actualIAsyncEnumerable<T>?- The sequence to inspect.
messagestring?actualExpressionstring?- The expression that produced the actual value.
Returns
Single<T>(IEnumerable<T>?, Func<T, bool>, string?, string?, string?)
Assert.Single.csAsserts 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
actualIEnumerable<T>?- The enumerable to inspect.
predicateFunc<T, bool>- The predicate used to select matching items.
messagestring?actualExpressionstring?- The expression that produced the actual value.
predicateExpressionstring?- The expression that produced the predicate.
Returns
T
Single<T>(IEnumerable<T>?, string?, string?)
Assert.Single.csAsserts 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
actualIEnumerable<T>?- The enumerable to inspect.
messagestring?actualExpressionstring?- The expression that produced the actual value.
Returns
T
Single<T>(ReadOnlySpan<T>, string?, string?)
Assert.Single.csAsserts 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
actualReadOnlySpan<T>- The span to inspect.
messagestring?actualExpressionstring?- The expression that produced the actual value.
Returns
T
Single<T>(T[]?, string?, string?)
Assert.Single.csAsserts that an array is not null, contains a single item and returns it.
Type parameters
T
Parameters
actualT[]?- The array to inspect.
messagestring?actualExpressionstring?- 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.csAsserts 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
expectedchar- The character expected at the start of
actual. actualstring?- The string to inspect.
comparerIEqualityComparer<char>?- The comparer used to compare characters.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
StartsWith(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)
Assert.StartsWith.csAsserts 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
expectedIEnumerable- The prefix expected at the start of
actual. Withoutcomparer, the assertion also succeeds whenexpectedis itself the first item ofactual. A string is compared as an item, unlessactualis a sequence of characters. actualIEnumerable?- The enumerable to inspect.
comparerIEqualityComparer?- The comparer used to compare values.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
StartsWith(object?, IEnumerable?, string?, string?, string?)
Assert.StartsWith.csAsserts 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
expectedobject?- The value expected at the start of
actual. A string compared to a sequence of characters is compared as a prefix. actualIEnumerable?- The enumerable to inspect.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
StartsWith(ReadOnlySpan<char>, ReadOnlySpan<char>, bool, string?, string?, string?)
Assert.StartsWith.csAsserts 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
expectedReadOnlySpan<char>- The prefix expected at the start of
actual. actualReadOnlySpan<char>- The span to inspect.
ignoreCasebool- When
true, the comparison ignores casing (OrdinalIgnoreCase); otherwise, it is case-sensitive (Ordinal). messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
StartsWith(ReadOnlySpan<char>, ReadOnlySpan<char>, StringComparison, string?, string?, string?)
Assert.StartsWith.csAsserts 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
expectedReadOnlySpan<char>- The prefix expected at the start of
actual. actualReadOnlySpan<char>- The span to inspect.
comparisonTypeStringComparison- The comparison used to compare
expectedwith the start ofactual. messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
StartsWith(string, string?, bool, string?, string?, string?)
Assert.StartsWith.csAsserts 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
expectedstring- The prefix expected at the start of
actual. actualstring?- The string to inspect.
ignoreCasebool- When
true, the comparison ignores casing (OrdinalIgnoreCase); otherwise, it is case-sensitive (Ordinal). messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
StartsWith(string, string?, StringComparison, string?, string?, string?)
Assert.StartsWith.csAsserts 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
expectedstring- The prefix expected at the start of
actual. actualstring?- The string to inspect.
comparisonTypeStringComparison- The comparison used to compare
expectedwith the start ofactual. messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
StartsWith<T>(IEnumerable<T>, IAsyncEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Assert.StartsWith.csAsserts 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
expectedIEnumerable<T>- The prefix expected at the start of
actual. Whenexpectedis itself the first item ofactual, the assertion also succeeds. actualIAsyncEnumerable<T>?- The sequence to inspect.
comparerIEqualityComparer<T>?- The comparer used to compare values.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
Returns
StartsWith<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Assert.StartsWith.csAsserts 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
expectedIEnumerable<T>- The prefix expected at the start of
actual. Whenexpectedis itself the first item ofactual, the assertion also succeeds. actualIEnumerable<T>?- The enumerable to inspect.
comparerIEqualityComparer<T>?- The comparer used to compare values.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
StartsWith<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)
Assert.StartsWith.csAsserts 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
expectedReadOnlySpan<T>- The prefix expected at the start of
actual. actualReadOnlySpan<T>- The span to inspect.
comparerIEqualityComparer<T>?- The comparer used to compare values.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
StartsWith<T>(T, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Assert.StartsWith.csAsserts 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
expectedT- The value expected at the start of
actual. actualIEnumerable<T>?- The enumerable to inspect.
comparerIEqualityComparer<T>?- The comparer used to compare values.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
StartsWith<T>(T, ReadOnlySpan<T>, IEqualityComparer<T>?, string?, string?, string?)
Assert.StartsWith.csAsserts 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
expectedT- The value expected at the start of
actual. actualReadOnlySpan<T>- The span to inspect.
comparerIEqualityComparer<T>?- The comparer used to compare values.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
StartsWith<T>(T, T[]?, IEqualityComparer<T>?, string?, string?, string?)
Assert.StartsWith.csAsserts 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
expectedT- The value expected at the start of
actual. actualT[]?- The array to inspect.
comparerIEqualityComparer<T>?- The comparer used to compare values.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected value.
Subset overloads
Subset(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)
Assert.Set.csAsserts 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
expectedSupersetIEnumerable- The collection expected to contain every unique item in
actual. actualIEnumerable?- The collection expected to be a subset of
expectedSuperset. comparerIEqualityComparer?- The comparer used to compare values.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected superset.
Subset<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Assert.Set.csAsserts 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
expectedSupersetIEnumerable<T>- The collection expected to contain every unique item in
actual. actualIEnumerable<T>?- The collection expected to be a subset of
expectedSuperset. comparerIEqualityComparer<T>?- The comparer used to compare values. When
nullandactualis a set, the set compares values itself, likeISet<T>.IsSubsetOf; otherwiseEqualityComparer<T>.Defaultis used. messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected superset.
Superset overloads
Superset(IEnumerable, IEnumerable?, IEqualityComparer?, string?, string?, string?)
Assert.Set.csAsserts 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
expectedSubsetIEnumerable- The collection whose unique items are all expected in
actual. actualIEnumerable?- The collection expected to be a superset of
expectedSubset. comparerIEqualityComparer?- The comparer used to compare values.
messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected subset.
Superset<T>(IEnumerable<T>, IEnumerable<T>?, IEqualityComparer<T>?, string?, string?, string?)
Assert.Set.csAsserts 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
expectedSubsetIEnumerable<T>- The collection whose unique items are all expected in
actual. actualIEnumerable<T>?- The collection expected to be a superset of
expectedSubset. comparerIEqualityComparer<T>?- The comparer used to compare values. When
nullandactualis a set, the set compares values itself, likeISet<T>.IsSupersetOf; otherwiseEqualityComparer<T>.Defaultis used. messagestring?actualExpressionstring?- The expression that produced the actual value.
expectedExpressionstring?- The expression that produced the expected subset.
Throws overloads
Throws(Type, Action, string?, string?)
Assert.Throws.csThrows(Type, Func<object?>, string?, string?)
Assert.Throws.csAsserts 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
expectedExceptionTypeType- The exact expected exception type.
actionFunc<object?>- The function expected to throw.
messagestring?actionExpressionstring?- The expression that produced the function.
Returns
Exception The thrown exception.
Throws(Type, Func<Task<object?>>, string?, string?)
Assert.Throws.csAsserts 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
expectedExceptionTypeType- The exact expected exception type.
actionFunc<Task<object?>>- The asynchronous function expected to throw.
messagestring?actionExpressionstring?- The expression that produced the function.
Returns
Task<Exception> The thrown exception.
Throws(Type, Func<Task>, string?, string?)
Assert.Throws.csAsserts 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
expectedExceptionTypeType- The exact expected exception type.
actionFunc<Task>- The asynchronous action expected to throw.
messagestring?actionExpressionstring?- The expression that produced the action.
Returns
Task<Exception> The thrown exception.
Throws(Type, Func<ValueTask<object?>>, string?, string?)
Assert.Throws.csAsserts 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
expectedExceptionTypeType- The exact expected exception type.
actionFunc<ValueTask<object?>>- The asynchronous function expected to throw.
messagestring?actionExpressionstring?- The expression that produced the function.
Returns
Task<Exception> The thrown exception.
Throws(Type, Func<ValueTask>, string?, string?)
Assert.Throws.csAsserts 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
expectedExceptionTypeType- The exact expected exception type.
actionFunc<ValueTask>- The asynchronous action expected to throw.
messagestring?actionExpressionstring?- The expression that produced the action.
Returns
Task<Exception> The thrown exception.
Throws<T>(Action, string?, string?)
Assert.Throws.csThrows<T>(Func<object?>, string?, string?)
Assert.Throws.csAsserts 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 : ExceptionType parameters
T- The exact expected exception type.
Parameters
actionFunc<object?>- The function expected to throw.
messagestring?actionExpressionstring?- The expression that produced the function.
Returns
T The thrown exception.
Throws<T>(Func<Task<object?>>, string?, string?)
Assert.Throws.csAsserts 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 : Exceptionnet11.0
public static Task<T> Throws<T>(Func<Task<object?>> action, string? message = null, string? actionExpression = null) where T : ExceptionType parameters
T- The exact expected exception type.
Parameters
actionFunc<Task<object?>>- The asynchronous function expected to throw.
messagestring?actionExpressionstring?- The expression that produced the function.
Returns
Task<T> The thrown exception.
Throws<T>(Func<Task>, string?, string?)
Assert.Throws.csAsserts 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 : Exceptionnet11.0
public static Task<T> Throws<T>(Func<Task> action, string? message = null, string? actionExpression = null) where T : ExceptionType parameters
T- The exact expected exception type.
Parameters
actionFunc<Task>- The asynchronous action expected to throw.
messagestring?actionExpressionstring?- The expression that produced the action.
Returns
Task<T> The thrown exception.
Throws<T>(Func<ValueTask<object?>>, string?, string?)
Assert.Throws.csAsserts 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 : Exceptionnet11.0
public static Task<T> Throws<T>(Func<ValueTask<object?>> action, string? message = null, string? actionExpression = null) where T : ExceptionType parameters
T- The exact expected exception type.
Parameters
actionFunc<ValueTask<object?>>- The asynchronous function expected to throw.
messagestring?actionExpressionstring?- The expression that produced the function.
Returns
Task<T> The thrown exception.
Throws<T>(Func<ValueTask>, string?, string?)
Assert.Throws.csAsserts 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 : Exceptionnet11.0
public static Task<T> Throws<T>(Func<ValueTask> action, string? message = null, string? actionExpression = null) where T : ExceptionType parameters
T- The exact expected exception type.
Parameters
actionFunc<ValueTask>- The asynchronous action expected to throw.
messagestring?actionExpressionstring?- The expression that produced the action.
Returns
Task<T> The thrown exception.
Throws<T>(string?, Action, string?, string?)
Assert.Throws.csAsserts 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 : ArgumentExceptionThrows<T>(string?, Func<object?>, string?, string?)
Assert.Throws.csAsserts 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 : ArgumentExceptionType parameters
T- The exact expected exception type.
Parameters
paramNamestring?- The expected parameter name.
actionFunc<object?>- The function expected to throw.
messagestring?actionExpressionstring?- The expression that produced the function.
Returns
T The thrown exception.
Throws<T>(string?, Func<Task<object?>>, string?, string?)
Assert.Throws.csAsserts 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 : ArgumentExceptionnet11.0
public static Task<T> Throws<T>(string? paramName, Func<Task<object?>> action, string? message = null, string? actionExpression = null) where T : ArgumentExceptionType parameters
T- The exact expected exception type.
Parameters
paramNamestring?- The expected parameter name.
actionFunc<Task<object?>>- The asynchronous function expected to throw.
messagestring?actionExpressionstring?- The expression that produced the function.
Returns
Task<T> The thrown exception.
Throws<T>(string?, Func<Task>, string?, string?)
Assert.Throws.csAsserts 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 : ArgumentExceptionnet11.0
public static Task<T> Throws<T>(string? paramName, Func<Task> action, string? message = null, string? actionExpression = null) where T : ArgumentExceptionType parameters
T- The exact expected exception type.
Parameters
paramNamestring?- The expected parameter name.
actionFunc<Task>- The asynchronous action expected to throw.
messagestring?actionExpressionstring?- The expression that produced the action.
Returns
Task<T> The thrown exception.
Throws<T>(string?, Func<ValueTask<object?>>, string?, string?)
Assert.Throws.csAsserts 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 : ArgumentExceptionnet11.0
public static Task<T> Throws<T>(string? paramName, Func<ValueTask<object?>> action, string? message = null, string? actionExpression = null) where T : ArgumentExceptionType parameters
T- The exact expected exception type.
Parameters
paramNamestring?- The expected parameter name.
actionFunc<ValueTask<object?>>- The asynchronous function expected to throw.
messagestring?actionExpressionstring?- The expression that produced the function.
Returns
Task<T> The thrown exception.
Throws<T>(string?, Func<ValueTask>, string?, string?)
Assert.Throws.csAsserts 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 : ArgumentExceptionnet11.0
public static Task<T> Throws<T>(string? paramName, Func<ValueTask> action, string? message = null, string? actionExpression = null) where T : ArgumentExceptionType parameters
T- The exact expected exception type.
Parameters
paramNamestring?- The expected parameter name.
actionFunc<ValueTask>- The asynchronous action expected to throw.
messagestring?actionExpressionstring?- The expression that produced the action.
Returns
Task<T> The thrown exception.
ThrowsAny overloads
ThrowsAny(Type, Action, string?, string?)
Assert.Throws.csThrowsAny(Type, Func<object?>, string?, string?)
Assert.Throws.csAsserts 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
expectedExceptionTypeType- The expected base exception type.
actionFunc<object?>- The function expected to throw.
messagestring?actionExpressionstring?- The expression that produced the function.
Returns
Exception The thrown exception.
ThrowsAny(Type, Func<Task<object?>>, string?, string?)
Assert.Throws.csAsserts 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
expectedExceptionTypeType- The expected base exception type.
actionFunc<Task<object?>>- The asynchronous function expected to throw.
messagestring?actionExpressionstring?- The expression that produced the function.
Returns
Task<Exception> The thrown exception.
ThrowsAny(Type, Func<Task>, string?, string?)
Assert.Throws.csAsserts 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
expectedExceptionTypeType- The expected base exception type.
actionFunc<Task>- The asynchronous action expected to throw.
messagestring?actionExpressionstring?- The expression that produced the action.
Returns
Task<Exception> The thrown exception.
ThrowsAny(Type, Func<ValueTask<object?>>, string?, string?)
Assert.Throws.csAsserts 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
expectedExceptionTypeType- The expected base exception type.
actionFunc<ValueTask<object?>>- The asynchronous function expected to throw.
messagestring?actionExpressionstring?- The expression that produced the function.
Returns
Task<Exception> The thrown exception.
ThrowsAny(Type, Func<ValueTask>, string?, string?)
Assert.Throws.csAsserts 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
expectedExceptionTypeType- The expected base exception type.
actionFunc<ValueTask>- The asynchronous action expected to throw.
messagestring?actionExpressionstring?- The expression that produced the action.
Returns
Task<Exception> The thrown exception.
ThrowsAny<T>(Action, string?, string?)
Assert.Throws.csThrowsAny<T>(Func<object?>, string?, string?)
Assert.Throws.csAsserts 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 : ExceptionType parameters
T- The expected base exception type.
Parameters
actionFunc<object?>- The function expected to throw.
messagestring?actionExpressionstring?- The expression that produced the function.
Returns
T The thrown exception.
ThrowsAny<T>(Func<Task<object?>>, string?, string?)
Assert.Throws.csAsserts 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 : Exceptionnet11.0
public static Task<T> ThrowsAny<T>(Func<Task<object?>> action, string? message = null, string? actionExpression = null) where T : ExceptionType parameters
T- The expected base exception type.
Parameters
actionFunc<Task<object?>>- The asynchronous function expected to throw.
messagestring?actionExpressionstring?- The expression that produced the function.
Returns
Task<T> The thrown exception.
ThrowsAny<T>(Func<Task>, string?, string?)
Assert.Throws.csAsserts 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 : Exceptionnet11.0
public static Task<T> ThrowsAny<T>(Func<Task> action, string? message = null, string? actionExpression = null) where T : ExceptionType parameters
T- The expected base exception type.
Parameters
actionFunc<Task>- The asynchronous action expected to throw.
messagestring?actionExpressionstring?- The expression that produced the action.
Returns
Task<T> The thrown exception.
ThrowsAny<T>(Func<ValueTask<object?>>, string?, string?)
Assert.Throws.csAsserts 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 : Exceptionnet11.0
public static Task<T> ThrowsAny<T>(Func<ValueTask<object?>> action, string? message = null, string? actionExpression = null) where T : ExceptionType parameters
T- The expected base exception type.
Parameters
actionFunc<ValueTask<object?>>- The asynchronous function expected to throw.
messagestring?actionExpressionstring?- The expression that produced the function.
Returns
Task<T> The thrown exception.
ThrowsAny<T>(Func<ValueTask>, string?, string?)
Assert.Throws.csAsserts 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 : Exceptionnet11.0
public static Task<T> ThrowsAny<T>(Func<ValueTask> action, string? message = null, string? actionExpression = null) where T : ExceptionType parameters
T- The expected base exception type.
Parameters
actionFunc<ValueTask>- The asynchronous action expected to throw.
messagestring?actionExpressionstring?- The expression that produced the action.
Returns
Task<T> The thrown exception.
ThrowsAnyAsync overloads
ThrowsAnyAsync(Type, Func<Task<object?>>, string?, string?)
Assert.Throws.csCompatibility 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
expectedExceptionTypeType- The expected base exception type.
actionFunc<Task<object?>>- The asynchronous function expected to throw.
messagestring?actionExpressionstring?- The expression that produced the function.
Returns
Task<Exception> The thrown exception.
ThrowsAnyAsync(Type, Func<Task>, string?, string?)
Assert.Throws.csCompatibility 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
expectedExceptionTypeType- The expected base exception type.
actionFunc<Task>- The asynchronous action expected to throw.
messagestring?actionExpressionstring?- The expression that produced the action.
Returns
Task<Exception> The thrown exception.
ThrowsAnyAsync<T>(Func<Task<object?>>, string?, string?)
Assert.Throws.csCompatibility 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 : Exceptionnet11.0
public static Task<T> ThrowsAnyAsync<T>(Func<Task<object?>> action, string? message = null, string? actionExpression = null) where T : ExceptionType parameters
T- The expected base exception type.
Parameters
actionFunc<Task<object?>>- The asynchronous function expected to throw.
messagestring?actionExpressionstring?- The expression that produced the function.
Returns
Task<T> The thrown exception.
ThrowsAnyAsync<T>(Func<Task>, string?, string?)
Assert.Throws.csCompatibility 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 : Exceptionnet11.0
public static Task<T> ThrowsAnyAsync<T>(Func<Task> action, string? message = null, string? actionExpression = null) where T : ExceptionType parameters
T- The expected base exception type.
Parameters
actionFunc<Task>- The asynchronous action expected to throw.
messagestring?actionExpressionstring?- The expression that produced the action.
Returns
Task<T> The thrown exception.
ThrowsAsync overloads
ThrowsAsync(Type, Func<Task<object?>>, string?, string?)
Assert.Throws.csCompatibility 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
expectedExceptionTypeType- The exact expected exception type.
actionFunc<Task<object?>>- The asynchronous function expected to throw.
messagestring?actionExpressionstring?- The expression that produced the function.
Returns
Task<Exception> The thrown exception.
ThrowsAsync(Type, Func<Task>, string?, string?)
Assert.Throws.csCompatibility 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
expectedExceptionTypeType- The exact expected exception type.
actionFunc<Task>- The asynchronous action expected to throw.
messagestring?actionExpressionstring?- The expression that produced the action.
Returns
Task<Exception> The thrown exception.
ThrowsAsync<T>(Func<Task<object?>>, string?, string?)
Assert.Throws.csCompatibility 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 : Exceptionnet11.0
public static Task<T> ThrowsAsync<T>(Func<Task<object?>> action, string? message = null, string? actionExpression = null) where T : ExceptionType parameters
T- The exact expected exception type.
Parameters
actionFunc<Task<object?>>- The asynchronous function expected to throw.
messagestring?actionExpressionstring?- The expression that produced the function.
Returns
Task<T> The thrown exception.
ThrowsAsync<T>(Func<Task>, string?, string?)
Assert.Throws.csCompatibility 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 : Exceptionnet11.0
public static Task<T> ThrowsAsync<T>(Func<Task> action, string? message = null, string? actionExpression = null) where T : ExceptionType parameters
T- The exact expected exception type.
Parameters
actionFunc<Task>- The asynchronous action expected to throw.
messagestring?actionExpressionstring?- The expression that produced the action.
Returns
Task<T> The thrown exception.
ThrowsAsync<T>(string?, Func<Task>, string?, string?)
Assert.Throws.csCompatibility 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 : ArgumentExceptionnet11.0
public static Task<T> ThrowsAsync<T>(string? paramName, Func<Task> action, string? message = null, string? actionExpression = null) where T : ArgumentExceptionType parameters
T- The exact expected exception type.
Parameters
paramNamestring?- The expected parameter name.
actionFunc<Task>- The asynchronous action expected to throw.
messagestring?actionExpressionstring?- The expression that produced the action.
Returns
Task<T> The thrown exception.
True overloads
True(bool, string?, string?)
Assert.True.csAsserts that a condition is true. If the condition is false, an AssertionException is thrown.
True(bool?, string?, string?)
Assert.True.csAsserts that a nullable condition is true. If the condition is false or null, an AssertionException is thrown.
UseFormatterOptions(FormatterOptions)
Assert.csUses 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
optionsFormatterOptions- 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.csSkips the currently running xunit test by throwing an AssertionException whose message uses the format expected by xunit for dynamically skipped tests.
Parameters
reasonstring- The reason why the test is skipped.