shouldBeIn

Used to assert that one value is in an array of specified values.

void
shouldBeIn
(
T
U
)
(
,,
in string message = null
,
in string file = __FILE__
,
in size_t line = __LINE__
)

Parameters

value
Type: T

The value to test.

expected
Type: U

An array of valid values.

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 the value is not in the array, will throw an UnitTestException with the value and array values.

Examples

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

Meta