tpierrain/NFluent

IsAFailingCheckWithMessage's error messages may be inacurate

dupdob opened this issue · 0 comments

When using IsAFailingCheckWithMessage(...) when testing checks (custom or not) you will have misleading error messages when the raised exception is not the expected one: they will report the error message instead of the exception type.

Expected Behavior

The error message must report the fundamental cause of check's failure.

Current Behavior

Check.ThatCode(() => throw new Exception("oups"))
           .IsAFailingCheckWithMessage("#[pous]+");

raises the following error message:

The exception raised is not of the expected type.
The checked fluent check's raised exception's error message:
    {"oups"} (1 item)
The expected fluent check's raised exception's error message:
    {"#[pous]+\"} (1 item)"

Possible Solution

This is likely due to an issue in the CheckLogic class when dealing with sub property checks.