Skip to main content

Char

Describes the possible expectations for char values.

Equality

You can verify that the char is equal to another one.

char subject = 'a';

await Expect.That(subject).IsEqualTo('a');
await Expect.That(subject).IsNotEqualTo('b');

One of

You can verify that the char is one of many alternatives.

char subject = 'a';

await Expect.That(subject).IsOneOf('a', 'b', 'c');
await Expect.That(subject).IsNotOneOf('x', 'y', 'z');

Is

An ASCII letter

You can verify that the char is an ASCII letter.

await Expect.That('a').IsAnAsciiLetter();

This verifies that the subject is an ASCII letter (see char.IsAsciiLetter(char)).

A letter

You can verify that the char is a letter.

await Expect.That('a').IsALetter();
await Expect.That('乐').IsALetter();

This verifies that the subject is categorized as a Unicode letter (see char.IsLetter(char)).

A number

You can verify that the char is a number.

await Expect.That('3').IsANumber();

This verifies that the subject is categorized as a Unicode number (see char.IsNumber(char)).

White-Space

You can verify that the char is white-space.

await Expect.That('\t').IsWhiteSpace();

This verifies that the subject is categorized as white-space (see char.IsWhiteSpace(char)).