I am running a foreach loop for a dictionary and using ShouldThrow
to throw exceptions on test failure.
But the loop is exiting on the first failure. Is there a way to postpone the actual violations and throw them as a single exception?
I am running a foreach loop for a dictionary and using ShouldThrow
to throw exceptions on test failure.
But the loop is exiting on the first failure. Is there a way to postpone the actual violations and throw them as a single exception?
You can wrap multiple calls to FluentAssertions assertion methods in a using new AssertionScope())
. This will cause it to collect all violations and throw them at the end of the using
block.