Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better handling of NaN in nullable numeric assertions #1867

Merged
merged 1 commit into from Mar 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Src/FluentAssertions/AssertionExtensions.cs
Expand Up @@ -686,7 +686,7 @@ public static NumericAssertions<float> Should(this float actualValue)
[Pure]
public static NullableNumericAssertions<float> Should(this float? actualValue)
{
return new NullableNumericAssertions<float>(actualValue);
return new NullableFloatAssertions(actualValue);
}

/// <summary>
Expand All @@ -706,7 +706,7 @@ public static NumericAssertions<double> Should(this double actualValue)
[Pure]
public static NullableNumericAssertions<double> Should(this double? actualValue)
{
return new NullableNumericAssertions<double>(actualValue);
return new NullableDoubleAssertions(actualValue);
}

/// <summary>
Expand Down
12 changes: 12 additions & 0 deletions Src/FluentAssertions/Numeric/NullableDoubleAssertions.cs
@@ -0,0 +1,12 @@
namespace FluentAssertions.Numeric
{
internal class NullableDoubleAssertions : NullableNumericAssertions<double>
{
public NullableDoubleAssertions(double? value)
: base(value)
{
}

private protected override bool IsNaN(double value) => double.IsNaN(value);
}
}
12 changes: 12 additions & 0 deletions Src/FluentAssertions/Numeric/NullableFloatAssertions.cs
@@ -0,0 +1,12 @@
namespace FluentAssertions.Numeric
{
internal class NullableFloatAssertions : NullableNumericAssertions<float>
{
public NullableFloatAssertions(float? value)
: base(value)
{
}

private protected override bool IsNaN(float value) => float.IsNaN(value);
}
}