Quantcast
Channel: Fluent Assertions
Viewing all articles
Browse latest Browse all 1402

Commented Issue: Should().BeApproximately() gives a false positive when comparing nullable with base type [12199]

$
0
0
I asked the following question on StackOverflow a few days ago, because I wasn't sure if I had missed something regarding nullable comparison, or if there is an actual bug in FluentAssertions: http://stackoverflow.com/questions/10752307/is-this-a-bug-when-comparing-a-nullable-type-with-its-underlying-type-using-flue

Since there hasn't been an answer to the question yet, I can only assume that it is a bug. In short, the issue seems to appear when comparing a nullable against its base type (float in my case):

float expected = 3.14f;
float notExpected = 1.0f;
float? actual = 3.14f;
actual.Should().BeApproximately(expected, 0.1f); // passes correctly
actual.Should().BeApproximately(notExpected, 0.1f); // passes, would expect it to fail

See the question on StackOverflow for more details.
Comments: ** Comment from web user: BeatW **

see also discussion at http://fluentassertions.codeplex.com/discussions/355272
okey.. It wasn't a discussion yet...


Viewing all articles
Browse latest Browse all 1402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>