When comparing the special infinity values (PositiveInfinity / NegativeInfinity) with NumericAssertionExtensions.BeApproximately(). I get an unexpected result. The following test fails:
// Arrange
double value = double.PositiveInfinity;
// Act
Action act = () => value.Should().BeApproximately(double.PositiveInfinity, 0.1);
// Assert
act.Should().NotThrow();
This is the same for float.
However, the inverse behaves as expected, with the following test passing.
// Arrange
double value = double.PositiveInfinity;
// Act
Action act = () => value.Should().NotBeApproximately(double.PositiveInfinity, 0.1);
// Assert
act.Should().Throw();
I could reproduce it as a test on the current version on the development branch. I will create a corresponding pull-request, to fix this.
@dennisdoomen This can be closed now?
@FabianNitsche FYI: if you write "this fixes #1270" in a PR on Github, the issue is automatically closed when the PR gets merged.
@dennisdoomen and @jnyrup: Thanks for all your help and this great project. Next contribution will be better quality. I already looked at help wanted cases for the next milestone.
Oh crap. Forgot to update the release notes md.
Most helpful comment
@dennisdoomen and @jnyrup: Thanks for all your help and this great project. Next contribution will be better quality. I already looked at help wanted cases for the next milestone.