Skip to content

Commit

Permalink
Merge remote-tracking branch 'AdadeusW/numericSuffix301'
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeGinnivan committed Dec 29, 2015
2 parents 81dff8f + 9e727b7 commit cac4d16
Show file tree
Hide file tree
Showing 34 changed files with 167 additions and 113 deletions.
35 changes: 35 additions & 0 deletions src/Shouldly.Tests/ShouldBe/NumericTypeSuffixInMessage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using Shouldly.Tests.Strings;
using Xunit;

namespace Shouldly.Tests.ShouldBe
{
public class NumericTypeSuffixInMessage
{
[Fact]
public void ShouldPass()
{
2.0f.ShouldBe(2UL);
}

[Fact]
public void NumericTypeSuffixInMessageInErrorMessage()
{
const ulong uLong = 2UL;
Verify.ShouldFail(() =>
uLong.ShouldBe(3UL),

errorWithSource:
@"uLong
should be
3uL
but was
2uL",

errorWithoutSource:
@"2uL
should be
3uL
but was not");
}
}
}
12 changes: 6 additions & 6 deletions src/Shouldly.Tests/ShouldBe/ShouldBeScenarios.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void BoxedComparableFailureScenario()
errorWithSource:
@"a
should be
0.1
0.1d
but was
0
Expand All @@ -56,7 +56,7 @@ but was
errorWithoutSource:
@"0
should be
0.1
0.1d
but was not
Additional Info:
Expand Down Expand Up @@ -311,17 +311,17 @@ public void NumbersOfDifferentTypesScenarioShouldFail()
errorWithSource:
@"aLong
should be
1
1L
but was
2
2L
Additional Info:
Some additional context",

errorWithoutSource:
@"2
@"2L
should be
1
1L
but was not
Additional Info:
Expand Down
12 changes: 6 additions & 6 deletions src/Shouldly.Tests/ShouldBe/WithTolerance/DecimalScenario.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ public void DecimalScenarioShouldFail()
errorWithSource:
@"pi
should be within
0.01
0.01m
of
3.24
3.24m
but was
3.14159265358979
3.14159265358979m
Additional Info:
Some additional context",

errorWithoutSource:
@"3.14159265358979
@"3.14159265358979m
should be within
0.01
0.01m
of
3.24
3.24m
but was not
Additional Info:
Expand Down
12 changes: 6 additions & 6 deletions src/Shouldly.Tests/ShouldBe/WithTolerance/DoubleScenario.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ public void DoubleScenarioShouldFail()
errorWithSource:
@"pi
should be within
0.01
0.01d
of
3.24
3.24d
but was
3.14159265358979
3.14159265358979d
Additional Info:
Some additional context",

errorWithoutSource:
@"3.14159265358979
@"3.14159265358979d
should be within
0.01
0.01d
of
3.24
3.24d
but was not
Additional Info:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,26 @@ public void EnumerableOfDecimalScenarioShouldFail()
errorWithSource:
@"firstSet
should be within
0.1
0.1m
of
[1.4301, 2.34, 3.45]
[1.4301m, 2.34m, 3.45m]
but was
[1.23, 2.34, 3.45001]
[1.23m, 2.34m, 3.45001m]
difference
[*1.23*, 2.34, *3.45001*]
[*1.23m*, 2.34m, *3.45001m*]
Additional Info:
Some additional context",

errorWithoutSource:
@"[1.23, 2.34, 3.45001]
@"[1.23m, 2.34m, 3.45001m]
should be within
0.1
0.1m
of
[1.4301, 2.34, 3.45]
[1.4301m, 2.34m, 3.45m]
but was not
difference
[*1.23*, 2.34, *3.45001*]
[*1.23m*, 2.34m, *3.45001m*]
Additional Info:
Some additional context");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,26 @@ public void EnumerableOfDoubleScenarioShouldFail()
errorWithSource:
@"new[] { Math.PI, Math.PI }
should be within
0.01
0.01d
of
[3.24, 3.24]
[3.24d, 3.24d]
but was
[3.14159265358979, 3.14159265358979]
[3.14159265358979d, 3.14159265358979d]
difference
[*3.14159265358979*, *3.14159265358979*]
[*3.14159265358979d*, *3.14159265358979d*]
Additional Info:
Some additional context",

errorWithoutSource:
@"[3.14159265358979, 3.14159265358979]
@"[3.14159265358979d, 3.14159265358979d]
should be within
0.01
0.01d
of
[3.24, 3.24]
[3.24d, 3.24d]
but was not
difference
[*3.14159265358979*, *3.14159265358979*]
[*3.14159265358979d*, *3.14159265358979d*]
Additional Info:
Some additional context");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,26 @@ public void EnumerableOfFloatScenarioShouldFail()
errorWithSource:
@"new[] { (float)Math.PI, (float)Math.PI }
should be within
0.01
0.01d
of
[3.24, 3.24]
[3.24f, 3.24f]
but was
[3.141593, 3.141593]
[3.141593f, 3.141593f]
difference
[*3.141593*, *3.141593*]
[*3.141593f*, *3.141593f*]
Additional Info:
Some additional context",

errorWithoutSource:
@"[3.141593, 3.141593]
@"[3.141593f, 3.141593f]
should be within
0.01
0.01d
of
[3.24, 3.24]
[3.24f, 3.24f]
but was not
difference
[*3.141593*, *3.141593*]
[*3.141593f*, *3.141593f*]
Additional Info:
Some additional context");
Expand Down
12 changes: 6 additions & 6 deletions src/Shouldly.Tests/ShouldBe/WithTolerance/FloatScenario.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ public void FloatScenarioShouldFail()
errorWithSource:
@"pi
should be within
0.01
0.01d
of
3.24
3.24f
but was
3.141593
3.141593f
Additional Info:
Some additional context",

errorWithoutSource:
@"3.141593
@"3.141593f
should be within
0.01
0.01d
of
3.24
3.24f
but was not
Additional Info:
Expand Down
11 changes: 6 additions & 5 deletions src/Shouldly.Tests/ShouldBeInRange/DecimalScenaro.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,22 @@ public class DecimalScenaro
[Fact]
public void DecimalScenaroShouldFail()
{
var val = 1.5m;
Verify.ShouldFail(() =>
1.5m.ShouldBeInRange(1.6m, 1.7m, "Some additional context"),
val.ShouldBeInRange(1.6m, 1.7m, "Some additional context"),

errorWithSource:
@"1.5m
@"val
should be in range
{ from = 1.6, to = 1.7 }
but was
1.5
1.5m
Additional Info:
Some additional context",

errorWithoutSource:
@"1.5
@"1.5m
should be in range
{ from = 1.6, to = 1.7 }
but was not
Expand All @@ -32,7 +33,7 @@ but was
Some additional context");
}

[Fact]
[Fact]
public void ShouldPass()
{
1.5m.ShouldBeInRange(1.4m, 1.6m);
Expand Down
4 changes: 2 additions & 2 deletions src/Shouldly.Tests/ShouldBeNegative/DecimalScenario.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ public void DecimalScenarioShouldFail()
errorWithSource:
@"@decimal
should be negative but
3.5
3.5m
is positive
Additional Info:
Some additional context",

errorWithoutSource:
@"3.5
@"3.5m
should be negative but is positive
Additional Info:
Expand Down
4 changes: 2 additions & 2 deletions src/Shouldly.Tests/ShouldBeNegative/DoubleScenario.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ public void DoubleScenarioShouldFail()
errorWithSource:
@"@decimal
should be negative but
3.5
3.5d
is positive
Additional Info:
Some additional context",

errorWithoutSource:
@"3.5
@"3.5d
should be negative but is positive
Additional Info:
Expand Down
4 changes: 2 additions & 2 deletions src/Shouldly.Tests/ShouldBeNegative/FloatScenario.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ public void FloatScenarioShouldFail()
errorWithSource:
@"@float
should be negative but
3
3f
is positive
Additional Info:
Some additional context",

errorWithoutSource:
@"3
@"3f
should be negative but is positive
Additional Info:
Expand Down
4 changes: 2 additions & 2 deletions src/Shouldly.Tests/ShouldBeNegative/LongScenario.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ public void LongScenarioShouldFail()
errorWithSource:
@"@long
should be negative but
3
3L
is positive
Additional Info:
Some additional context",

errorWithoutSource:
@"3
@"3L
should be negative but is positive
Additional Info:
Expand Down
4 changes: 2 additions & 2 deletions src/Shouldly.Tests/ShouldBeNegative/ZeroDecimalScenario.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ public void ZeroDecimalScenarioShouldFail()
errorWithSource:
@"val
should be negative but
0
0m
is positive
Additional Info:
Some additional context",

errorWithoutSource:
@"0
@"0m
should be negative but is positive
Additional Info:
Expand Down

0 comments on commit cac4d16

Please sign in to comment.