Skip to content

Commit

Permalink
use some raw strings
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Oct 19, 2023
1 parent 00f74b8 commit 531945d
Show file tree
Hide file tree
Showing 19 changed files with 401 additions and 301 deletions.
120 changes: 68 additions & 52 deletions src/Shouldly.Tests/ShouldBeInOrder/IntegerArrayScenario.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,26 @@ public void ShouldFailWithDefaultDirection()
_descendingTarget.ShouldBeInOrder("Some additional context"),

errorWithSource:
@"_descendingTarget
should be in ascending order but was not.
The first out-of-order item was found at index 1:
4
"""
_descendingTarget
should be in ascending order but was not.
The first out-of-order item was found at index 1:
4

Additional Info:
Some additional context",
Additional Info:
Some additional context
""",

errorWithoutSource:
@"[5, 4, 3, 2, 1]
should be in ascending order but was not.
The first out-of-order item was found at index 1:
4
Additional Info:
Some additional context");
"""
[5, 4, 3, 2, 1]
should be in ascending order but was not.
The first out-of-order item was found at index 1:
4

Additional Info:
Some additional context
""");
}

[Fact]
Expand All @@ -37,22 +41,26 @@ public void ShouldFailWhenAscendingIsSpecified()
_descendingTarget.ShouldBeInOrder(SortDirection.Ascending, "Some additional context"),

errorWithSource:
@"_descendingTarget
should be in ascending order but was not.
The first out-of-order item was found at index 1:
4
"""
_descendingTarget
should be in ascending order but was not.
The first out-of-order item was found at index 1:
4

Additional Info:
Some additional context",
Additional Info:
Some additional context
""",

errorWithoutSource:
@"[5, 4, 3, 2, 1]
should be in ascending order but was not.
The first out-of-order item was found at index 1:
4
Additional Info:
Some additional context");
"""
[5, 4, 3, 2, 1]
should be in ascending order but was not.
The first out-of-order item was found at index 1:
4

Additional Info:
Some additional context
""");
}

[Fact]
Expand All @@ -62,22 +70,26 @@ public void ShouldFailWhenDescendingIsSpecified()
_ascendingTarget.ShouldBeInOrder(SortDirection.Descending, "Some additional context"),

errorWithSource:
@"_ascendingTarget
should be in descending order but was not.
The first out-of-order item was found at index 1:
2
"""
_ascendingTarget
should be in descending order but was not.
The first out-of-order item was found at index 1:
2

Additional Info:
Some additional context",
Additional Info:
Some additional context
""",

errorWithoutSource:
@"[1, 2, 3, 4, 5]
should be in descending order but was not.
The first out-of-order item was found at index 1:
2
Additional Info:
Some additional context");
"""
[1, 2, 3, 4, 5]
should be in descending order but was not.
The first out-of-order item was found at index 1:
2

Additional Info:
Some additional context
""");
}

[Fact]
Expand All @@ -87,22 +99,26 @@ public void ShouldFailWhenDescendingIsSpecifiedAndComparerIsGiven()
_ascendingTarget.ShouldBeInOrder(SortDirection.Descending, Comparer<int>.Default, "Some additional context"),

errorWithSource:
@"_ascendingTarget
should be in descending order but was not.
The first out-of-order item was found at index 1:
2
"""
_ascendingTarget
should be in descending order but was not.
The first out-of-order item was found at index 1:
2

Additional Info:
Some additional context",
Additional Info:
Some additional context
""",

errorWithoutSource:
@"[1, 2, 3, 4, 5]
should be in descending order but was not.
The first out-of-order item was found at index 1:
2
Additional Info:
Some additional context");
"""
[1, 2, 3, 4, 5]
should be in descending order but was not.
The first out-of-order item was found at index 1:
2

Additional Info:
Some additional context
""");
}

[Fact]
Expand Down
120 changes: 68 additions & 52 deletions src/Shouldly.Tests/ShouldBeInOrder/StringArrayScenario.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,26 @@ public void ShouldFailWithDefaultDirection()
_descendingTarget.ShouldBeInOrder("Some additional context"),

errorWithSource:
@"_descendingTarget
should be in ascending order but was not.
The first out-of-order item was found at index 1:
d
"""
_descendingTarget
should be in ascending order but was not.
The first out-of-order item was found at index 1:
d

Additional Info:
Some additional context",
Additional Info:
Some additional context
""",

errorWithoutSource:
@"[""e"", ""d"", ""c"", ""b"", ""a""]
should be in ascending order but was not.
The first out-of-order item was found at index 1:
d
Additional Info:
Some additional context");
"""
["e", "d", "c", "b", "a"]
should be in ascending order but was not.
The first out-of-order item was found at index 1:
d

Additional Info:
Some additional context
""");
}

[Fact]
Expand All @@ -37,22 +41,26 @@ public void ShouldFailWhenAscendingIsSpecified()
_descendingTarget.ShouldBeInOrder(SortDirection.Ascending, "Some additional context"),

errorWithSource:
@"_descendingTarget
should be in ascending order but was not.
The first out-of-order item was found at index 1:
d
"""
_descendingTarget
should be in ascending order but was not.
The first out-of-order item was found at index 1:
d

Additional Info:
Some additional context",
Additional Info:
Some additional context
""",

errorWithoutSource:
@"[""e"", ""d"", ""c"", ""b"", ""a""]
should be in ascending order but was not.
The first out-of-order item was found at index 1:
d
Additional Info:
Some additional context");
"""
["e", "d", "c", "b", "a"]
should be in ascending order but was not.
The first out-of-order item was found at index 1:
d

Additional Info:
Some additional context
""");
}

[Fact]
Expand All @@ -62,22 +70,26 @@ public void ShouldFailWhenDescendingIsSpecified()
_ascendingTarget.ShouldBeInOrder(SortDirection.Descending, "Some additional context"),

errorWithSource:
@"_ascendingTarget
should be in descending order but was not.
The first out-of-order item was found at index 1:
b
"""
_ascendingTarget
should be in descending order but was not.
The first out-of-order item was found at index 1:
b

Additional Info:
Some additional context",
Additional Info:
Some additional context
""",

errorWithoutSource:
@"[""a"", ""b"", ""c"", ""d"", ""e""]
should be in descending order but was not.
The first out-of-order item was found at index 1:
b
Additional Info:
Some additional context");
"""
["a", "b", "c", "d", "e"]
should be in descending order but was not.
The first out-of-order item was found at index 1:
b

Additional Info:
Some additional context
""");
}

[Fact]
Expand All @@ -87,22 +99,26 @@ public void ShouldFailWhenDescendingIsSpecifiedAndComparerIsGiven()
_ascendingTarget.ShouldBeInOrder(SortDirection.Descending, Comparer<string>.Default, "Some additional context"),

errorWithSource:
@"_ascendingTarget
should be in descending order but was not.
The first out-of-order item was found at index 1:
b
"""
_ascendingTarget
should be in descending order but was not.
The first out-of-order item was found at index 1:
b

Additional Info:
Some additional context",
Additional Info:
Some additional context
""",

errorWithoutSource:
@"[""a"", ""b"", ""c"", ""d"", ""e""]
should be in descending order but was not.
The first out-of-order item was found at index 1:
b
Additional Info:
Some additional context");
"""
["a", "b", "c", "d", "e"]
should be in descending order but was not.
The first out-of-order item was found at index 1:
b

Additional Info:
Some additional context
""");
}

[Fact]
Expand Down
30 changes: 17 additions & 13 deletions src/Shouldly.Tests/ShouldBeInRange/DecimalScenaro.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,27 @@ public void DecimalScenarioShouldFail()
val.ShouldBeInRange(1.6m, 1.7m, "Some additional context"),

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

Additional Info:
Some additional context",
Additional Info:
Some additional context
""",

errorWithoutSource:
@"1.5m
should be in range
{ from = 1.6, to = 1.7 }
but was not
"""
1.5m
should be in range
{ from = 1.6, to = 1.7 }
but was not

Additional Info:
Some additional context");
Additional Info:
Some additional context
""");
}

[Fact]
Expand Down

0 comments on commit 531945d

Please sign in to comment.