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
expectedTThe object that is expected not to be in the collection
collectionIEnumerable<T>The collection to be inspected
Type Parameters
TThe 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
expectedTThe object that is expected not to be in the collection
collectionIEnumerable<T>The collection to be inspected
comparerIEqualityComparer<T>The comparer used to equate objects in the collection with the expected object
Type Parameters
TThe 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
collectionIEnumerable<T>The collection to be inspected
filterPredicate<T>The filter used to find the item you're ensuring the collection does not contain
Type Parameters
TThe 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
expectedTKeyThe object expected to be in the collection.
collectionIDictionary<TKey, TValue>The collection to be inspected.
Type Parameters
TKeyThe type of the keys of the object to be verified.
TValueThe 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
expectedTKeyThe object expected to be in the collection.
collectionIReadOnlyDictionary<TKey, TValue>The collection to be inspected.
Type Parameters
TKeyThe type of the keys of the object to be verified.
TValueThe 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
expectedTKeyThe object expected to be in the collection.
collectionConcurrentDictionary<TKey, TValue>The collection to be inspected.
Type Parameters
TKeyThe type of the keys of the object to be verified.
TValueThe 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
expectedTKeyThe object expected to be in the collection.
collectionDictionary<TKey, TValue>The collection to be inspected.
Type Parameters
TKeyThe type of the keys of the object to be verified.
TValueThe 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
expectedTKeyThe object expected to be in the collection.
collectionReadOnlyDictionary<TKey, TValue>The collection to be inspected.
Type Parameters
TKeyThe type of the keys of the object to be verified.
TValueThe 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
expectedTKeyThe object expected to be in the collection.
collectionImmutableDictionary<TKey, TValue>The collection to be inspected.
Type Parameters
TKeyThe type of the keys of the object to be verified.
TValueThe 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
expectedSubMemoryMemory<T>The sub-Memory expected not to be in the Memory
actualMemoryMemory<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
expectedSubMemoryMemory<T>The sub-Memory expected not to be in the Memory
actualMemoryReadOnlyMemory<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
expectedSubMemoryReadOnlyMemory<T>The sub-Memory expected not to be in the Memory
actualMemoryMemory<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
expectedSubMemoryReadOnlyMemory<T>The sub-Memory expected not to be in the Memory
actualMemoryReadOnlyMemory<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
expectedTThe object that is expected not to be in the set
setISet<T>The set to be inspected
Type Parameters
TThe 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
expectedTThe object expected to be in the set
setHashSet<T>The set to be inspected
Type Parameters
TThe 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
expectedTThe object expected to be in the set
setSortedSet<T>The set to be inspected
Type Parameters
TThe 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
expectedTThe object expected to be in the set
setImmutableHashSet<T>The set to be inspected
Type Parameters
TThe 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
expectedTThe object expected to be in the set
setImmutableSortedSet<T>The set to be inspected
Type Parameters
TThe 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
expectedSubSpanSpan<T>The sub-span expected not to be in the span
actualSpanSpan<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
expectedSubSpanSpan<T>The sub-span expected not to be in the span
actualSpanReadOnlySpan<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
expectedSubSpanReadOnlySpan<T>The sub-span expected not to be in the span
actualSpanSpan<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
expectedSubSpanReadOnlySpan<T>The sub-span expected not to be in the span
actualSpanReadOnlySpan<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
expectedSubstringstringThe sub-string expected not to be in the string
actualStringstringThe 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
expectedSubstringstringThe sub-string expected not to be in the string
actualStringstringThe string to be inspected
comparisonTypeStringComparisonThe 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
expectedSubstringMemory<char>The sub-string expected not to be in the string
actualStringMemory<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
expectedSubstringMemory<char>The sub-string expected not to be in the string
actualStringReadOnlyMemory<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
expectedSubstringReadOnlyMemory<char>The sub-string expected not to be in the string
actualStringMemory<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
expectedSubstringReadOnlyMemory<char>The sub-string expected not to be in the string
actualStringReadOnlyMemory<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
expectedSubstringMemory<char>The sub-string expected not to be in the string
actualStringMemory<char>The string to be inspected
comparisonTypeStringComparisonThe 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
expectedSubstringMemory<char>The sub-string expected not to be in the string
actualStringReadOnlyMemory<char>The string to be inspected
comparisonTypeStringComparisonThe 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
expectedSubstringReadOnlyMemory<char>The sub-string expected not to be in the string
actualStringMemory<char>The string to be inspected
comparisonTypeStringComparisonThe 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
expectedSubstringReadOnlyMemory<char>The sub-string expected not to be in the string
actualStringReadOnlyMemory<char>The string to be inspected
comparisonTypeStringComparisonThe 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
expectedSubstringSpan<char>The sub-string expected not to be in the string
actualStringSpan<char>The string to be inspected
comparisonTypeStringComparisonThe 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
expectedSubstringSpan<char>The sub-string expected not to be in the string
actualStringReadOnlySpan<char>The string to be inspected
comparisonTypeStringComparisonThe 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
expectedSubstringReadOnlySpan<char>The sub-string expected not to be in the string
actualStringSpan<char>The string to be inspected
comparisonTypeStringComparisonThe 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
expectedSubstringReadOnlySpan<char>The sub-string expected not to be in the string
actualStringReadOnlySpan<char>The string to be inspected
comparisonTypeStringComparisonThe 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
expectedSubstringSpan<char>The sub-string expected not to be in the string
actualStringSpan<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
expectedSubstringSpan<char>The sub-string expected not to be in the string
actualStringReadOnlySpan<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
expectedSubstringReadOnlySpan<char>The sub-string expected not to be in the string
actualStringSpan<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
expectedSubstringReadOnlySpan<char>The sub-string expected not to be in the string
actualStringReadOnlySpan<char>The string to be inspected
Exceptions
Thrown when the sub-string is present inside the string