-
Notifications
You must be signed in to change notification settings - Fork 731
Description
Description
Running code like the below throws an error "Calling Equals on Assertion classes is not supported."
I understand that this by design and is a helpful guard rail to prevent someone from thinking they're using an assertion but actually doing an equality operation and the result being thrown away. Nice job there.
I think this error message could be improved. For example, it would be nice in the example below if the exception message also said "Did you mean Be()?".
Complete minimal example reproducing the issue
var x = 1;
var y = 2;
x.Should().Equals(y); // throws NotSupportedExceptionExpected behavior:
Expected the exception to point me in the right direction.
Actual behavior:
I had to search the Internet for the error, found this GitHub site, read the code, realized I was dumb and should have used Be().
Versions
Latest
Additional Information
I will put in a PR if you think that supplementing the Equals() error messages to point the user in the right direction would be useful. For many of the assertions, this might be to suggest Be() but perhaps there are others which would need to use something else? I haven't looked yet. Many thanks for this very useful library.