-3

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?

Dennis Doomen
  • 8,368
  • 1
  • 32
  • 44
sirisha
  • 11
  • 2

1 Answers1

1

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.

Dennis Doomen
  • 8,368
  • 1
  • 32
  • 44