shouldBeContain

Used to assert that array is contain of specified value.

void
shouldBeContain
(
T
U
)
(
T[] array
,,
in string message = null
,
in string file = __FILE__
,
in size_t line = __LINE__
)

Parameters

array
Type: T[]

An array of values.

expected
Type: U

The valid value.

message
Type: string

Exception message.

file
Type: string

The file name that the assert failed in. Should be left as default.

line
Type: size_t

The file line that the assert failed in. Should be left as default.

Throws

If an array is not contain the value, will throw an UnitTestException with the value and array values.

Examples

// Will throw an exception like "UnitTestException@example.d(6): <[Peter, Anatoliy]> is not contain <Andrew>."
["Peter", "Anatoly"].shouldBeContain("Andrew");

Meta