Table of Contents

Method DoesNotContain

Namespace
Xunit
Assembly
xunit.v3.assert.dll

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

Verifies that a collection does not contain a given object.

public static void DoesNotContain<T>(T expected, IEnumerable<T> collection)

Parameters

expected T

The object that is expected not to be in the collection

collection IEnumerable<T>

The collection to be inspected

Type Parameters

T

The type of the object to be compared

Exceptions

Thrown when the object is present inside the collection

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

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

public static void DoesNotContain<T>(T expected, IEnumerable<T> collection, IEqualityComparer<T> comparer)

Parameters

expected T

The object that is expected not to be in the collection

collection IEnumerable<T>

The collection to be inspected

comparer IEqualityComparer<T>

The comparer used to equate objects in the collection with the expected object

Type Parameters

T

The type of the object to be compared

Exceptions

Thrown when the object is present inside the collection

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

Verifies that a collection does not contain a given object.

public static void DoesNotContain<T>(IEnumerable<T> collection, Predicate<T> filter)

Parameters

collection IEnumerable<T>

The collection to be inspected

filter Predicate<T>

The filter used to find the item you're ensuring the collection does not contain

Type Parameters

T

The type of the object to be compared

Exceptions

Thrown when the object is present inside the collection

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

Verifies that a dictionary does not contain a given key.

public static void DoesNotContain<TKey, TValue>(TKey expected, IDictionary<TKey, TValue> collection) where TKey : notnull

Parameters

expected TKey

The object expected to be in the collection.

collection IDictionary<TKey, TValue>

The collection to be inspected.

Type Parameters

TKey

The type of the keys of the object to be verified.

TValue

The type of the values of the object to be verified.

Exceptions

Thrown when the object is present in the collection

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

Verifies that a dictionary does not contain a given key.

public static void DoesNotContain<TKey, TValue>(TKey expected, IReadOnlyDictionary<TKey, TValue> collection) where TKey : notnull

Parameters

expected TKey

The object expected to be in the collection.

collection IReadOnlyDictionary<TKey, TValue>

The collection to be inspected.

Type Parameters

TKey

The type of the keys of the object to be verified.

TValue

The type of the values of the object to be verified.

Exceptions

Thrown when the object is present in the collection

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

Verifies that a dictionary does not contain a given key.

public static void DoesNotContain<TKey, TValue>(TKey expected, ConcurrentDictionary<TKey, TValue> collection) where TKey : notnull

Parameters

expected TKey

The object expected to be in the collection.

collection ConcurrentDictionary<TKey, TValue>

The collection to be inspected.

Type Parameters

TKey

The type of the keys of the object to be verified.

TValue

The type of the values of the object to be verified.

Exceptions

Thrown when the object is present in the collection

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

Verifies that a dictionary does not contain a given key.

public static void DoesNotContain<TKey, TValue>(TKey expected, Dictionary<TKey, TValue> collection) where TKey : notnull

Parameters

expected TKey

The object expected to be in the collection.

collection Dictionary<TKey, TValue>

The collection to be inspected.

Type Parameters

TKey

The type of the keys of the object to be verified.

TValue

The type of the values of the object to be verified.

Exceptions

Thrown when the object is present in the collection

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

Verifies that a dictionary does not contain a given key.

public static void DoesNotContain<TKey, TValue>(TKey expected, ReadOnlyDictionary<TKey, TValue> collection) where TKey : notnull

Parameters

expected TKey

The object expected to be in the collection.

collection ReadOnlyDictionary<TKey, TValue>

The collection to be inspected.

Type Parameters

TKey

The type of the keys of the object to be verified.

TValue

The type of the values of the object to be verified.

Exceptions

Thrown when the object is present in the collection

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

Verifies that a dictionary does not contain a given key.

public static void DoesNotContain<TKey, TValue>(TKey expected, ImmutableDictionary<TKey, TValue> collection) where TKey : notnull

Parameters

expected TKey

The object expected to be in the collection.

collection ImmutableDictionary<TKey, TValue>

The collection to be inspected.

Type Parameters

TKey

The type of the keys of the object to be verified.

TValue

The type of the values of the object to be verified.

Exceptions

Thrown when the object is present in the collection

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

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

public static void DoesNotContain<T>(Memory<T> expectedSubMemory, Memory<T> actualMemory) where T : IEquatable<T>

Parameters

expectedSubMemory Memory<T>

The sub-Memory expected not to be in the Memory

actualMemory Memory<T>

The Memory to be inspected

Type Parameters

T

Exceptions

Thrown when the sub-Memory is present inside the Memory

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

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

public static void DoesNotContain<T>(Memory<T> expectedSubMemory, ReadOnlyMemory<T> actualMemory) where T : IEquatable<T>

Parameters

expectedSubMemory Memory<T>

The sub-Memory expected not to be in the Memory

actualMemory ReadOnlyMemory<T>

The Memory to be inspected

Type Parameters

T

Exceptions

Thrown when the sub-Memory is present inside the Memory

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

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

public static void DoesNotContain<T>(ReadOnlyMemory<T> expectedSubMemory, Memory<T> actualMemory) where T : IEquatable<T>

Parameters

expectedSubMemory ReadOnlyMemory<T>

The sub-Memory expected not to be in the Memory

actualMemory Memory<T>

The Memory to be inspected

Type Parameters

T

Exceptions

Thrown when the sub-Memory is present inside the Memory

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

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

public static void DoesNotContain<T>(ReadOnlyMemory<T> expectedSubMemory, ReadOnlyMemory<T> actualMemory) where T : IEquatable<T>

Parameters

expectedSubMemory ReadOnlyMemory<T>

The sub-Memory expected not to be in the Memory

actualMemory ReadOnlyMemory<T>

The Memory to be inspected

Type Parameters

T

Exceptions

Thrown when the sub-Memory is present inside the Memory

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

Verifies that the set does not contain the given item.

public static void DoesNotContain<T>(T expected, ISet<T> set)

Parameters

expected T

The object that is expected not to be in the set

set ISet<T>

The set to be inspected

Type Parameters

T

The type of the object to be compared

Exceptions

Thrown when the object is present inside the set

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

Verifies that the hashset does not contain the given item.

public static void DoesNotContain<T>(T expected, HashSet<T> set)

Parameters

expected T

The object expected to be in the set

set HashSet<T>

The set to be inspected

Type Parameters

T

The type of the object to be verified

Exceptions

Thrown when the object is not present in the set

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

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

public static void DoesNotContain<T>(T expected, SortedSet<T> set)

Parameters

expected T

The object expected to be in the set

set SortedSet<T>

The set to be inspected

Type Parameters

T

The type of the object to be verified

Exceptions

Thrown when the object is not present in the set

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

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

public static void DoesNotContain<T>(T expected, ImmutableHashSet<T> set)

Parameters

expected T

The object expected to be in the set

set ImmutableHashSet<T>

The set to be inspected

Type Parameters

T

The type of the object to be verified

Exceptions

Thrown when the object is not present in the set

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

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

public static void DoesNotContain<T>(T expected, ImmutableSortedSet<T> set)

Parameters

expected T

The object expected to be in the set

set ImmutableSortedSet<T>

The set to be inspected

Type Parameters

T

The type of the object to be verified

Exceptions

Thrown when the object is not present in the set

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

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

public static void DoesNotContain<T>(Span<T> expectedSubSpan, Span<T> actualSpan) where T : IEquatable<T>

Parameters

expectedSubSpan Span<T>

The sub-span expected not to be in the span

actualSpan Span<T>

The span to be inspected

Type Parameters

T

Exceptions

Thrown when the sub-span is present inside the span

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

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

public static void DoesNotContain<T>(Span<T> expectedSubSpan, ReadOnlySpan<T> actualSpan) where T : IEquatable<T>

Parameters

expectedSubSpan Span<T>

The sub-span expected not to be in the span

actualSpan ReadOnlySpan<T>

The span to be inspected

Type Parameters

T

Exceptions

Thrown when the sub-span is present inside the span

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

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

public static void DoesNotContain<T>(ReadOnlySpan<T> expectedSubSpan, Span<T> actualSpan) where T : IEquatable<T>

Parameters

expectedSubSpan ReadOnlySpan<T>

The sub-span expected not to be in the span

actualSpan Span<T>

The span to be inspected

Type Parameters

T

Exceptions

Thrown when the sub-span is present inside the span

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

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

public static void DoesNotContain<T>(ReadOnlySpan<T> expectedSubSpan, ReadOnlySpan<T> actualSpan) where T : IEquatable<T>

Parameters

expectedSubSpan ReadOnlySpan<T>

The sub-span expected not to be in the span

actualSpan ReadOnlySpan<T>

The span to be inspected

Type Parameters

T

Exceptions

Thrown when the sub-span is present inside the span

DoesNotContain(string, string?)

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

public static void DoesNotContain(string expectedSubstring, string? actualString)

Parameters

expectedSubstring string

The sub-string expected not to be in the string

actualString string

The string to be inspected

Exceptions

Thrown when the sub-string is present inside the string

DoesNotContain(string, string?, StringComparison)

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

public static void DoesNotContain(string expectedSubstring, string? actualString, StringComparison comparisonType)

Parameters

expectedSubstring string

The sub-string expected not to be in the string

actualString string

The string to be inspected

comparisonType StringComparison

The type of string comparison to perform

Exceptions

Thrown when the sub-string is present inside the string

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

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

public static void DoesNotContain(Memory<char> expectedSubstring, Memory<char> actualString)

Parameters

expectedSubstring Memory<char>

The sub-string expected not to be in the string

actualString Memory<char>

The string to be inspected

Exceptions

Thrown when the sub-string is present inside the string

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

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

public static void DoesNotContain(Memory<char> expectedSubstring, ReadOnlyMemory<char> actualString)

Parameters

expectedSubstring Memory<char>

The sub-string expected not to be in the string

actualString ReadOnlyMemory<char>

The string to be inspected

Exceptions

Thrown when the sub-string is present inside the string

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

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

public static void DoesNotContain(ReadOnlyMemory<char> expectedSubstring, Memory<char> actualString)

Parameters

expectedSubstring ReadOnlyMemory<char>

The sub-string expected not to be in the string

actualString Memory<char>

The string to be inspected

Exceptions

Thrown when the sub-string is present inside the string

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

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

public static void DoesNotContain(ReadOnlyMemory<char> expectedSubstring, ReadOnlyMemory<char> actualString)

Parameters

expectedSubstring ReadOnlyMemory<char>

The sub-string expected not to be in the string

actualString ReadOnlyMemory<char>

The string to be inspected

Exceptions

Thrown when the sub-string is present inside the string

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

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

public static void DoesNotContain(Memory<char> expectedSubstring, Memory<char> actualString, StringComparison comparisonType = StringComparison.CurrentCulture)

Parameters

expectedSubstring Memory<char>

The sub-string expected not to be in the string

actualString Memory<char>

The string to be inspected

comparisonType StringComparison

The type of string comparison to perform

Exceptions

Thrown when the sub-string is present inside the string

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

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

public static void DoesNotContain(Memory<char> expectedSubstring, ReadOnlyMemory<char> actualString, StringComparison comparisonType = StringComparison.CurrentCulture)

Parameters

expectedSubstring Memory<char>

The sub-string expected not to be in the string

actualString ReadOnlyMemory<char>

The string to be inspected

comparisonType StringComparison

The type of string comparison to perform

Exceptions

Thrown when the sub-string is present inside the string

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

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

public static void DoesNotContain(ReadOnlyMemory<char> expectedSubstring, Memory<char> actualString, StringComparison comparisonType = StringComparison.CurrentCulture)

Parameters

expectedSubstring ReadOnlyMemory<char>

The sub-string expected not to be in the string

actualString Memory<char>

The string to be inspected

comparisonType StringComparison

The type of string comparison to perform

Exceptions

Thrown when the sub-string is present inside the string

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

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

public static void DoesNotContain(ReadOnlyMemory<char> expectedSubstring, ReadOnlyMemory<char> actualString, StringComparison comparisonType = StringComparison.CurrentCulture)

Parameters

expectedSubstring ReadOnlyMemory<char>

The sub-string expected not to be in the string

actualString ReadOnlyMemory<char>

The string to be inspected

comparisonType StringComparison

The type of string comparison to perform

Exceptions

Thrown when the sub-string is present inside the string

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

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

public static void DoesNotContain(Span<char> expectedSubstring, Span<char> actualString, StringComparison comparisonType = StringComparison.CurrentCulture)

Parameters

expectedSubstring Span<char>

The sub-string expected not to be in the string

actualString Span<char>

The string to be inspected

comparisonType StringComparison

The type of string comparison to perform

Exceptions

Thrown when the sub-string is present inside the string

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

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

public static void DoesNotContain(Span<char> expectedSubstring, ReadOnlySpan<char> actualString, StringComparison comparisonType = StringComparison.CurrentCulture)

Parameters

expectedSubstring Span<char>

The sub-string expected not to be in the string

actualString ReadOnlySpan<char>

The string to be inspected

comparisonType StringComparison

The type of string comparison to perform

Exceptions

Thrown when the sub-string is present inside the string

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

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

public static void DoesNotContain(ReadOnlySpan<char> expectedSubstring, Span<char> actualString, StringComparison comparisonType = StringComparison.CurrentCulture)

Parameters

expectedSubstring ReadOnlySpan<char>

The sub-string expected not to be in the string

actualString Span<char>

The string to be inspected

comparisonType StringComparison

The type of string comparison to perform

Exceptions

Thrown when the sub-string is present inside the string

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

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

public static void DoesNotContain(ReadOnlySpan<char> expectedSubstring, ReadOnlySpan<char> actualString, StringComparison comparisonType = StringComparison.CurrentCulture)

Parameters

expectedSubstring ReadOnlySpan<char>

The sub-string expected not to be in the string

actualString ReadOnlySpan<char>

The string to be inspected

comparisonType StringComparison

The type of string comparison to perform

Exceptions

Thrown when the sub-string is present inside the string

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

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

public static void DoesNotContain(Span<char> expectedSubstring, Span<char> actualString)

Parameters

expectedSubstring Span<char>

The sub-string expected not to be in the string

actualString Span<char>

The string to be inspected

Exceptions

Thrown when the sub-string is present inside the string

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

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

public static void DoesNotContain(Span<char> expectedSubstring, ReadOnlySpan<char> actualString)

Parameters

expectedSubstring Span<char>

The sub-string expected not to be in the string

actualString ReadOnlySpan<char>

The string to be inspected

Exceptions

Thrown when the sub-string is present inside the string

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

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

public static void DoesNotContain(ReadOnlySpan<char> expectedSubstring, Span<char> actualString)

Parameters

expectedSubstring ReadOnlySpan<char>

The sub-string expected not to be in the string

actualString Span<char>

The string to be inspected

Exceptions

Thrown when the sub-string is present inside the string

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

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

public static void DoesNotContain(ReadOnlySpan<char> expectedSubstring, ReadOnlySpan<char> actualString)

Parameters

expectedSubstring ReadOnlySpan<char>

The sub-string expected not to be in the string

actualString ReadOnlySpan<char>

The string to be inspected

Exceptions

Thrown when the sub-string is present inside the string