Table of Contents

Class SingleException

Namespace
Xunit.Sdk
Assembly
xunit.v3.assert.dll

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

expected string

The expected value (set to null for no expected value)

collection string

The collection

Returns

SingleException

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

count int

The number of items, or the number of matching items

expected string

The expected value (set to null for no expected value)

collection string

The collection

matchIndices ICollection<int>

The list of indices where matches occurred

Returns

SingleException