Search code examples
fluent-assertions

FluentAssertions without exceptions?


This seems like a long shot...

I am building a test harness for manual testing (for my QA Team). It runs in a console application and can output some level of smart data, but nothing so automatic as a fully automated test (not my rules).

I would love to use FluentAssertions to generate the text to show, but I don't want to throw an exception.

Is there a way to have FluentAssertions just output a string with its fluent message? (Without throwing an exception.)

NOTE: I am aware of a possible workaround: (Try/Catch statements around an AssertionScope around my fluent assertion checks). But I am hoping to keep the extra code to a minimum so as to not confuse the non-programmer QA person that has to use the test harness.


Solution

  • You could replace the Services.ThrowException property with custom behavior or you could use AssertionScope's Discard method.