Negation
Almost every expectation has a negated counterpart that starts with IsNot… or DoesNot…, e.g. IsNotEqualTo,
DoesNotContain or DoesNotStartWith. The Has… expectations take a negated comparison instead, e.g.
HasLength().NotEqualTo(9), and the quantifiers of a collection use None(). The table at the top of each reference
page lists the negated counterparts.
DoesNotComplyWith negates any expectation, including your own:
string title = "Abbey Road";
await That(title).DoesNotComplyWith(it => it.StartsWith("Let").And.EndsWith("Be"));
DoesNotComplyWith is the exact inverse: it succeeds as soon as the nested expectation fails, except for a null
subject (see below). A named negation can be stricter: e.g.
DoesNotContainKeys means "none of" and fails as soon as the
dictionary contains one of the keys, while DoesNotComplyWith(d => d.ContainsKeys(…)) means "not all" and only fails
when it contains all of them.
A null subject fails most expectations and their negations alike, also inside DoesNotComplyWith, see
null subjects.