Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在为字典运行 foreach 循环,并ShouldThrow用于在测试失败时引发异常。
ShouldThrow
但是循环在第一次失败时退出。有没有办法推迟实际违规并将它们作为单个异常抛出?
您可以将多个对 FluentAssertions 断言方法的调用包装在using new AssertionScope()). 这将导致它收集所有违规行为并将它们扔到using块的末尾。
using new AssertionScope())
using