Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding VisitTypeBinary override for ExpressionStringBuilder
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
src/Shouldly.Tests/ShouldAllBe/TypeBinaryExpressionScenario.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using Shouldly.Tests.Strings; | ||
using System.Collections.Generic; | ||
using Xunit; | ||
|
||
namespace Shouldly.Tests.ShouldAllBe | ||
{ | ||
public class TypeBinaryExpressionScenario | ||
{ | ||
[Fact] | ||
public void TypeBinaryExpressionScenarioShouldFail() | ||
{ | ||
List<object> objects = new List<object> { "1", 1 }; | ||
|
||
Verify.ShouldFail(() => | ||
objects.ShouldAllBe(x => x is string, "Some additional context"), | ||
|
||
errorWithSource: | ||
@"objects | ||
should satisfy the condition | ||
(x Is String) | ||
but | ||
[1] | ||
do not | ||
Additional Info: | ||
Some additional context", | ||
|
||
errorWithoutSource: | ||
@"[""1"", 1] | ||
should satisfy the condition | ||
(x Is String) | ||
but | ||
[1] | ||
do not | ||
Additional Info: | ||
Some additional context"); | ||
} | ||
|
||
[Fact] | ||
public void ShouldPass() | ||
{ | ||
new[] { "1", "2", "3" }.ShouldAllBe(x => x is string); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters