Class SingleException
Exception thrown when Assert.Single fails.
public class SingleException : XunitException, ISerializable, IAssertionException
- Inheritance
-
SingleException
- Implements
- Inherited Members
Methods
Empty(string?, string)
Creates an new instance of the SingleException class to be thrown when the collection didn't contain any values (or didn't contain the expected value).
public static SingleException Empty(string? expected, string collection)
Parameters
expectedstringThe expected value (set to
nullfor no expected value)collectionstringThe collection
Returns
MoreThanOne(int, string?, string, ICollection<int>)
Creates an new instance of the SingleException class to be thrown when the collection more than one value (or contained more than one of the expected value).
public static SingleException MoreThanOne(int count, string? expected, string collection, ICollection<int> matchIndices)
Parameters
countintThe number of items, or the number of matching items
expectedstringThe expected value (set to
nullfor no expected value)collectionstringThe collection
matchIndicesICollection<int>The list of indices where matches occurred