-
-
Notifications
You must be signed in to change notification settings - Fork 379
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #333 from JakeGinnivan/ShouldBeWithOptions
Should be with options
- Loading branch information
Showing
67 changed files
with
841 additions
and
206 deletions.
There are no files selected for viewing
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
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
61 changes: 61 additions & 0 deletions
61
src/Shouldly.Tests/InternalTests/StringShouldBeAssertionTests.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,61 @@ | ||
using NUnit.Framework; | ||
using Shouldly.DifferenceHighlighting2; | ||
using Shouldly.Internals; | ||
using Shouldly.Internals.Assertions; | ||
|
||
namespace Shouldly.Tests.InternalTests | ||
{ | ||
[TestFixture] | ||
public class StringShouldBeAssertionTests | ||
{ | ||
[Test] | ||
public static void IsSatisfied_should_return_true_when_the_lambda_parameter_returns_true() | ||
{ | ||
var sut = new StringShouldBeAssertion( | ||
"", "", (e, a) => true, null, null); | ||
Assert.That(sut.IsSatisfied()); | ||
} | ||
|
||
[Test] | ||
public static void IsSatisfied_should_return_false_when_the_lambda_parameter_returns_false() | ||
{ | ||
var sut = new StringShouldBeAssertion( | ||
"", "", (e, a) => false, null, null); | ||
Assert.That(!sut.IsSatisfied()); | ||
} | ||
|
||
[Test] | ||
public static void GenerateMessage_should_generate_the_correct_message_when_the_lambda_parameter_returns_false() | ||
{ | ||
var sut = new StringShouldBeAssertion( | ||
"expected", "actual", (e, a) => false, | ||
new MockCodeTextGetter(), | ||
new MockDiffHighlighter()); | ||
var expected = @" | ||
SomeCodeText | ||
should be | ||
""expected"" | ||
but was | ||
""actual"" | ||
difference | ||
expected and actual are different! | ||
Additional Info: | ||
custom message"; | ||
|
||
var actual = sut.GenerateMessage("custom message"); | ||
|
||
Assert.AreEqual(expected, actual); | ||
} | ||
private class MockCodeTextGetter : ICodeTextGetter | ||
{ | ||
public string GetCodeText() { return "SomeCodeText"; } | ||
} | ||
private class MockDiffHighlighter : IStringDifferenceHighlighter | ||
{ | ||
public string HighlightDifferences(string expected, string actual) | ||
{ | ||
return string.Format("{0} and {1} are different!", expected, actual); | ||
} | ||
} | ||
} | ||
} |
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.