Skip to main content

Practice ยท 2 of 3

Extend the Assertion Set

CHALLENGE
Difficulty: intermediate+25 XP

Two assertions every framework needs: Throws<T> (true iff the action throws exactly T or a subclass โ€” other exception types must propagate as a false-ish *result*, not escape) and SeqEq<T> (value equality over two sequences, including null handling). ``csharp static bool Throws<T>(Action a) where T : Exception; static bool SeqEq<T>(IEnumerable<T>? a, IEnumerable<T>? b); // null == null โ†’ true; one null โ†’ false ``

Back to lesson: Practice: Testing Practice: Runner, Assertions, Isolation