When running
When_the_subjects_property_type_is_different_from_the_equality_comparer_it_should_throw
with a debugger attached
EqualityComparerEquivalencyStep<T> throws an InvalidCastException when context.Subject is T fails as the second ForCondition is executed with (T)context.Subject.
The second ForCondition is executed because:
Execute.Assertion uses the AssertionScope from EquivalencyValidator.AssertEquality,
- that is constructed using
new AssertionScope(),
- which defaults to
CollectingAssertionStrategy,
- which does not throw on first failure.
Even though the failure message is correct, Exceptions are not nice.