diff --git a/Source/aweXpect.Core/Options/CollectionMatchOptions.cs b/Source/aweXpect.Core/Options/CollectionMatchOptions.cs index a343fddfa..6597c8456 100644 --- a/Source/aweXpect.Core/Options/CollectionMatchOptions.cs +++ b/Source/aweXpect.Core/Options/CollectionMatchOptions.cs @@ -364,7 +364,7 @@ public sealed class ExpectationItem { private readonly CancellationToken _cancellationToken; private readonly IEvaluationContext _context; - internal readonly ManualExpectationBuilder _itemExpectationBuilder; + internal readonly ManualExpectationBuilder ItemExpectationBuilder; /// public ExpectationItem(Action> expectation, @@ -374,8 +374,8 @@ public ExpectationItem(Action> expectation, { _context = context; _cancellationToken = cancellationToken; - _itemExpectationBuilder = new ManualExpectationBuilder(null, grammars); - expectation.Invoke(new ThatSubject(_itemExpectationBuilder)); + ItemExpectationBuilder = new ManualExpectationBuilder(null, grammars); + expectation.Invoke(new ThatSubject(ItemExpectationBuilder)); } /// @@ -387,7 +387,7 @@ public async ValueTask IsMetBy(TItem value) public async Task IsMetBy(TItem value) #endif { - ConstraintResult result = await _itemExpectationBuilder.IsMetBy(value, _context, _cancellationToken); + ConstraintResult result = await ItemExpectationBuilder.IsMetBy(value, _context, _cancellationToken); return result.Outcome == Outcome.Success; } @@ -395,13 +395,13 @@ public async Task IsMetBy(TItem value) public override bool Equals(object? obj) => obj is ExpectationItem other && Equals(other); private bool Equals(ExpectationItem other) - => _itemExpectationBuilder.Equals(other._itemExpectationBuilder); + => ItemExpectationBuilder.Equals(other.ItemExpectationBuilder); /// - public override int GetHashCode() => _itemExpectationBuilder.GetHashCode(); + public override int GetHashCode() => ItemExpectationBuilder.GetHashCode(); /// - public override string ToString() => _itemExpectationBuilder.ToString(); + public override string ToString() => ItemExpectationBuilder.ToString(); } internal sealed class ExpectationItemEqualityComparer : IEqualityComparer> @@ -423,9 +423,9 @@ public bool Equals(ExpectationItem? x, ExpectationItem? y) return false; } - return x._itemExpectationBuilder.Equals(y._itemExpectationBuilder); + return x.ItemExpectationBuilder.Equals(y.ItemExpectationBuilder); } - public int GetHashCode(ExpectationItem obj) => obj._itemExpectationBuilder.GetHashCode(); + public int GetHashCode(ExpectationItem obj) => obj.ItemExpectationBuilder.GetHashCode(); } } diff --git a/Source/aweXpect/That/Collections/ThatAsyncEnumerable.HasItemThat.cs b/Source/aweXpect/That/Collections/ThatAsyncEnumerable.HasItemThat.cs index 066d4df3c..ffe3e3dab 100644 --- a/Source/aweXpect/That/Collections/ThatAsyncEnumerable.HasItemThat.cs +++ b/Source/aweXpect/That/Collections/ThatAsyncEnumerable.HasItemThat.cs @@ -51,7 +51,7 @@ public HasItemThatConstraint(ExpectationBuilder expectationBuilder, _it = it; _options = options; - _itemExpectationBuilder = new ManualExpectationBuilder(_expectationBuilder, Grammars); + _itemExpectationBuilder = new ManualExpectationBuilder(null, Grammars); expectations.Invoke(new ThatSubject(_itemExpectationBuilder)); } diff --git a/Source/aweXpect/That/Collections/ThatEnumerable.HasItemThat.cs b/Source/aweXpect/That/Collections/ThatEnumerable.HasItemThat.cs index 79c9f1369..a49c0f6fc 100644 --- a/Source/aweXpect/That/Collections/ThatEnumerable.HasItemThat.cs +++ b/Source/aweXpect/That/Collections/ThatEnumerable.HasItemThat.cs @@ -73,7 +73,7 @@ public HasItemThatConstraint(ExpectationBuilder expectationBuilder, _it = it; _options = options; - _itemExpectationBuilder = new ManualExpectationBuilder(_expectationBuilder, Grammars); + _itemExpectationBuilder = new ManualExpectationBuilder(null, Grammars); expectations.Invoke(new ThatSubject(_itemExpectationBuilder)); } @@ -189,7 +189,7 @@ public HasItemThatForEnumerableConstraint(ExpectationBuilder expectationBuilder, _it = it; _options = options; - _itemExpectationBuilder = new ManualExpectationBuilder(_expectationBuilder, Grammars); + _itemExpectationBuilder = new ManualExpectationBuilder(null, Grammars); expectations.Invoke(new ThatSubject(_itemExpectationBuilder)); } diff --git a/Source/aweXpect/That/Strings/ThatString.EndsWith.cs b/Source/aweXpect/That/Strings/ThatString.EndsWith.cs index e4d660f3a..459cb0854 100644 --- a/Source/aweXpect/That/Strings/ThatString.EndsWith.cs +++ b/Source/aweXpect/That/Strings/ThatString.EndsWith.cs @@ -13,14 +13,14 @@ public static partial class ThatString /// /// Verifies that the subject ends with the . /// - public static StringEqualityTypeResult> EndsWith( + public static StringEqualityResult> EndsWith( this IThat source, string expected) { - StringEqualityOptions options = new(); - return new StringEqualityTypeResult>( - source.Get().ExpectationBuilder.AddConstraint((it, grammars) => - new EndsWithConstraint(it, grammars, expected, options)), + StringEqualityOptions options = new StringEqualityOptions().AsSuffix(); + return new StringEqualityResult>( + source.Get().ExpectationBuilder.AddConstraint((expectationBuilder, it, grammars) => + new IsEqualToConstraint(expectationBuilder, it, grammars, expected, options)), source, options); } @@ -28,14 +28,14 @@ public static partial class ThatString /// /// Verifies that the subject does not end with the . /// - public static StringEqualityTypeResult> DoesNotEndWith( + public static StringEqualityResult> DoesNotEndWith( this IThat source, string unexpected) { - StringEqualityOptions options = new(); - return new StringEqualityTypeResult>( - source.Get().ExpectationBuilder.AddConstraint((it, grammars) => - new EndsWithConstraint(it, grammars, unexpected, options).Invert()), + StringEqualityOptions options = new StringEqualityOptions().AsSuffix(); + return new StringEqualityResult>( + source.Get().ExpectationBuilder.AddConstraint((expectationBuilder, it, grammars) => + new IsEqualToConstraint(expectationBuilder, it, grammars, unexpected, options).Invert()), source, options); } diff --git a/Source/aweXpect/That/Strings/ThatString.StartsWith.cs b/Source/aweXpect/That/Strings/ThatString.StartsWith.cs index 4eeacbc07..c4304f3a4 100644 --- a/Source/aweXpect/That/Strings/ThatString.StartsWith.cs +++ b/Source/aweXpect/That/Strings/ThatString.StartsWith.cs @@ -13,14 +13,14 @@ public static partial class ThatString /// /// Verifies that the subject starts with the . /// - public static StringEqualityTypeResult> StartsWith( + public static StringEqualityResult> StartsWith( this IThat source, string expected) { - StringEqualityOptions options = new(); - return new StringEqualityTypeResult>( - source.Get().ExpectationBuilder.AddConstraint((it, grammars) => - new StartsWithConstraint(it, grammars, expected, options)), + StringEqualityOptions options = new StringEqualityOptions().AsPrefix(); + return new StringEqualityResult>( + source.Get().ExpectationBuilder.AddConstraint((expectationBuilder, it, grammars) => + new IsEqualToConstraint(expectationBuilder, it, grammars, expected, options)), source, options); } @@ -28,14 +28,14 @@ public static partial class ThatString /// /// Verifies that the subject does not start with the . /// - public static StringEqualityTypeResult> DoesNotStartWith( + public static StringEqualityResult> DoesNotStartWith( this IThat source, string unexpected) { - StringEqualityOptions options = new(); - return new StringEqualityTypeResult>( - source.Get().ExpectationBuilder.AddConstraint((it, grammars) => - new StartsWithConstraint(it, grammars, unexpected, options).Invert()), + StringEqualityOptions options = new StringEqualityOptions().AsPrefix(); + return new StringEqualityResult>( + source.Get().ExpectationBuilder.AddConstraint((expectationBuilder, it, grammars) => + new IsEqualToConstraint(expectationBuilder, it, grammars, unexpected, options).Invert()), source, options); } diff --git a/Tests/aweXpect.Api.Tests/Expected/aweXpect_net8.0.txt b/Tests/aweXpect.Api.Tests/Expected/aweXpect_net8.0.txt index c813882d7..ec282ac3d 100644 --- a/Tests/aweXpect.Api.Tests/Expected/aweXpect_net8.0.txt +++ b/Tests/aweXpect.Api.Tests/Expected/aweXpect_net8.0.txt @@ -1146,9 +1146,9 @@ namespace aweXpect { public static aweXpect.Results.StringEqualityTypeCountResult> Contains(this aweXpect.Core.IThat source, string expected) { } public static aweXpect.Results.StringEqualityTypeCountResult> DoesNotContain(this aweXpect.Core.IThat source, string unexpected) { } - public static aweXpect.Results.StringEqualityTypeResult> DoesNotEndWith(this aweXpect.Core.IThat source, string unexpected) { } - public static aweXpect.Results.StringEqualityTypeResult> DoesNotStartWith(this aweXpect.Core.IThat source, string unexpected) { } - public static aweXpect.Results.StringEqualityTypeResult> EndsWith(this aweXpect.Core.IThat source, string expected) { } + public static aweXpect.Results.StringEqualityResult> DoesNotEndWith(this aweXpect.Core.IThat source, string unexpected) { } + public static aweXpect.Results.StringEqualityResult> DoesNotStartWith(this aweXpect.Core.IThat source, string unexpected) { } + public static aweXpect.Results.StringEqualityResult> EndsWith(this aweXpect.Core.IThat source, string expected) { } public static aweXpect.Results.PropertyResult.Int HasLength(this aweXpect.Core.IThat source) { } public static aweXpect.Results.AndOrResult> IsEmpty(this aweXpect.Core.IThat source) { } public static aweXpect.Results.StringEqualityTypeResult> IsEqualTo(this aweXpect.Core.IThat source, string? expected) { } @@ -1172,7 +1172,7 @@ namespace aweXpect public static aweXpect.Results.IsParsableResult IsParsableInto(this aweXpect.Core.IThat source, System.IFormatProvider? formatProvider = null) where TType : System.IParsable { } public static aweXpect.Results.AndOrResult> IsUpperCased(this aweXpect.Core.IThat source) { } - public static aweXpect.Results.StringEqualityTypeResult> StartsWith(this aweXpect.Core.IThat source, string expected) { } + public static aweXpect.Results.StringEqualityResult> StartsWith(this aweXpect.Core.IThat source, string expected) { } } public static class ThatTimeOnly { diff --git a/Tests/aweXpect.Api.Tests/Expected/aweXpect_netstandard2.0.txt b/Tests/aweXpect.Api.Tests/Expected/aweXpect_netstandard2.0.txt index ae8ee362f..7b7c4406c 100644 --- a/Tests/aweXpect.Api.Tests/Expected/aweXpect_netstandard2.0.txt +++ b/Tests/aweXpect.Api.Tests/Expected/aweXpect_netstandard2.0.txt @@ -1121,9 +1121,9 @@ namespace aweXpect { public static aweXpect.Results.StringEqualityTypeCountResult> Contains(this aweXpect.Core.IThat source, string expected) { } public static aweXpect.Results.StringEqualityTypeCountResult> DoesNotContain(this aweXpect.Core.IThat source, string unexpected) { } - public static aweXpect.Results.StringEqualityTypeResult> DoesNotEndWith(this aweXpect.Core.IThat source, string unexpected) { } - public static aweXpect.Results.StringEqualityTypeResult> DoesNotStartWith(this aweXpect.Core.IThat source, string unexpected) { } - public static aweXpect.Results.StringEqualityTypeResult> EndsWith(this aweXpect.Core.IThat source, string expected) { } + public static aweXpect.Results.StringEqualityResult> DoesNotEndWith(this aweXpect.Core.IThat source, string unexpected) { } + public static aweXpect.Results.StringEqualityResult> DoesNotStartWith(this aweXpect.Core.IThat source, string unexpected) { } + public static aweXpect.Results.StringEqualityResult> EndsWith(this aweXpect.Core.IThat source, string expected) { } public static aweXpect.Results.PropertyResult.Int HasLength(this aweXpect.Core.IThat source) { } public static aweXpect.Results.AndOrResult> IsEmpty(this aweXpect.Core.IThat source) { } public static aweXpect.Results.StringEqualityTypeResult> IsEqualTo(this aweXpect.Core.IThat source, string? expected) { } @@ -1143,7 +1143,7 @@ namespace aweXpect public static aweXpect.Results.StringEqualityTypeResult> IsOneOf(this aweXpect.Core.IThat source, System.Collections.Generic.IEnumerable expected) { } public static aweXpect.Results.StringEqualityTypeResult> IsOneOf(this aweXpect.Core.IThat source, params string?[] expected) { } public static aweXpect.Results.AndOrResult> IsUpperCased(this aweXpect.Core.IThat source) { } - public static aweXpect.Results.StringEqualityTypeResult> StartsWith(this aweXpect.Core.IThat source, string expected) { } + public static aweXpect.Results.StringEqualityResult> StartsWith(this aweXpect.Core.IThat source, string expected) { } } public static class ThatTimeSpan { diff --git a/Tests/aweXpect.Tests/Strings/ThatString.DoesNotEndWith.Tests.cs b/Tests/aweXpect.Tests/Strings/ThatString.DoesNotEndWith.Tests.cs index fd5f152a9..eac777096 100644 --- a/Tests/aweXpect.Tests/Strings/ThatString.DoesNotEndWith.Tests.cs +++ b/Tests/aweXpect.Tests/Strings/ThatString.DoesNotEndWith.Tests.cs @@ -20,6 +20,9 @@ await That(Act).Throws() Expected that subject does not end with "TEXT" ignoring case, but it was "some text" + + Actual: + some text """); } @@ -51,6 +54,9 @@ await That(Act).Throws() Expected that subject does not end with "tExt" using IgnoreCaseForVocalsComparer, but it was "some arbitrary text" + + Actual: + some arbitrary text """); } @@ -69,7 +75,7 @@ async Task Act() } [Fact] - public async Task WhenExpectedIsNull_ShouldFail() + public async Task WhenExpectedIsNull_ShouldSucceed() { string subject = "text"; string? expected = null; @@ -77,12 +83,7 @@ public async Task WhenExpectedIsNull_ShouldFail() async Task Act() => await That(subject).DoesNotEndWith(expected!); - await That(Act).Throws() - .WithMessage(""" - Expected that subject - does not end with , - but "text" cannot be validated against - """); + await That(Act).DoesNotThrow(); } [Fact] @@ -99,6 +100,9 @@ await That(Act).Throws() Expected that subject does not end with "text", but it was "some text" + + Actual: + some text """); } @@ -128,11 +132,14 @@ await That(Act).Throws() Expected that subject does not end with "some text", but it was "some text" + + Actual: + some text """); } [Fact] - public async Task WhenSubjectIsNull_ShouldFail() + public async Task WhenSubjectIsNull_ShouldSucceed() { string? subject = null; string expected = "text"; @@ -140,12 +147,7 @@ public async Task WhenSubjectIsNull_ShouldFail() async Task Act() => await That(subject).DoesNotEndWith(expected); - await That(Act).Throws() - .WithMessage(""" - Expected that subject - does not end with "text", - but it was - """); + await That(Act).DoesNotThrow(); } } } diff --git a/Tests/aweXpect.Tests/Strings/ThatString.DoesNotStartWith.Tests.cs b/Tests/aweXpect.Tests/Strings/ThatString.DoesNotStartWith.Tests.cs index 1a9dc8dd2..c64ec32d2 100644 --- a/Tests/aweXpect.Tests/Strings/ThatString.DoesNotStartWith.Tests.cs +++ b/Tests/aweXpect.Tests/Strings/ThatString.DoesNotStartWith.Tests.cs @@ -32,6 +32,9 @@ await That(Act).Throws() Expected that subject does not start with "some", but it was "some text" + + Actual: + some text """); } @@ -65,11 +68,14 @@ await That(Act).Throws() Expected that subject does not start with "sOmE" using IgnoreCaseForVocalsComparer, but it was "some arbitrary text" + + Actual: + some arbitrary text """); } [Fact] - public async Task WhenExpectedIsNull_ShouldFail() + public async Task WhenExpectedIsNull_ShouldSucceed() { string subject = "text"; string? expected = null; @@ -77,12 +83,7 @@ public async Task WhenExpectedIsNull_ShouldFail() async Task Act() => await That(subject).DoesNotStartWith(expected!); - await That(Act).Throws() - .WithMessage(""" - Expected that subject - does not start with , - but "text" cannot be validated against - """); + await That(Act).DoesNotThrow(); } [Fact] @@ -111,6 +112,9 @@ await That(Act).Throws() Expected that subject does not start with "SOME" ignoring case, but it was "some text" + + Actual: + some text """); } @@ -128,11 +132,14 @@ await That(Act).Throws() Expected that subject does not start with "some text", but it was "some text" + + Actual: + some text """); } [Fact] - public async Task WhenSubjectIsNull_ShouldFail() + public async Task WhenSubjectIsNull_ShouldSucceed() { string? subject = null; string expected = "text"; @@ -140,12 +147,7 @@ public async Task WhenSubjectIsNull_ShouldFail() async Task Act() => await That(subject).DoesNotStartWith(expected); - await That(Act).Throws() - .WithMessage(""" - Expected that subject - does not start with "text", - but it was - """); + await That(Act).DoesNotThrow(); } } } diff --git a/Tests/aweXpect.Tests/Strings/ThatString.EndsWith.Tests.cs b/Tests/aweXpect.Tests/Strings/ThatString.EndsWith.Tests.cs index a76229848..3a28481b7 100644 --- a/Tests/aweXpect.Tests/Strings/ThatString.EndsWith.Tests.cs +++ b/Tests/aweXpect.Tests/Strings/ThatString.EndsWith.Tests.cs @@ -14,7 +14,7 @@ public async Task bool ignoreCase) { string subject = "some arbitrary text"; - string expected = "TEXT"; + string expected = "Text"; async Task Act() => await That(subject).EndsWith(expected).IgnoringCase(ignoreCase); @@ -23,8 +23,15 @@ await That(Act).Throws() .OnlyIf(!ignoreCase) .WithMessage(""" Expected that subject - ends with "TEXT", - but it was "some arbitrary text" + ends with "Text", + but it was "some arbitrary text" which differs at index 0: + ↓ (actual) + "some arbitrary text" + "Text" + ↑ (expected) + + Actual: + some arbitrary text """); } @@ -42,7 +49,14 @@ await That(Act).Throws() .WithMessage(""" Expected that subject ends with "SOME" ignoring case, - but it was "some arbitrary text" + but it was "some arbitrary text" which differs at index 4: + ↓ (actual) + "some arbitrary text" + "SOME" + ↑ (expected) + + Actual: + some arbitrary text """); } @@ -61,7 +75,14 @@ await That(Act).Throws() .WithMessage(""" Expected that subject ends with "TEXT" using IgnoreCaseForVocalsComparer, - but it was "some arbitrary text" + but it was "some arbitrary text" which differs at index 0: + ↓ (actual) + "some arbitrary text" + "TEXT" + ↑ (expected) + + Actual: + some arbitrary text """); } @@ -92,7 +113,10 @@ await That(Act).Throws() .WithMessage(""" Expected that subject ends with , - but "text" cannot be validated against + but it was "text" + + Actual: + text """); } @@ -109,7 +133,14 @@ await That(Act).Throws() .WithMessage(""" Expected that subject ends with "some", - but it was "some arbitrary text" + but it was "some arbitrary text" which differs at index 4: + ↓ (actual) + "some arbitrary text" + "some" + ↑ (expected) + + Actual: + some arbitrary text """); } @@ -167,7 +198,11 @@ await That(Act).Throws() .WithMessage(""" Expected that subject ends with "text and more", - but it was "text" and with length 4 is shorter than the expected length of 13 + but it was "text" with a length of 4 which is shorter than the expected length of 13 and misses: + " and more" + + Actual: + text """); } } diff --git a/Tests/aweXpect.Tests/Strings/ThatString.IsNotEqualTo.Tests.cs b/Tests/aweXpect.Tests/Strings/ThatString.IsNotEqualTo.Tests.cs index 45c28b5eb..5d2f668ca 100644 --- a/Tests/aweXpect.Tests/Strings/ThatString.IsNotEqualTo.Tests.cs +++ b/Tests/aweXpect.Tests/Strings/ThatString.IsNotEqualTo.Tests.cs @@ -7,13 +7,13 @@ public sealed partial class IsNotEqualTo public sealed class Tests { [Fact] - public async Task WhenActualAndUnunexpectedAreNull_ShouldSucceed() + public async Task WhenActualAndUnexpectedAreNull_ShouldSucceed() { string? subject = null; - string? ununexpected = null; + string? unexpected = null; async Task Act() - => await That(subject).IsNotEqualTo(ununexpected); + => await That(subject).IsNotEqualTo(unexpected); await That(Act).Throws() .WithMessage(""" @@ -27,22 +27,22 @@ but it was public async Task WhenActualIsNull_ShouldSucceed() { string? subject = null; - string ununexpected = "some text"; + string unexpected = "some text"; async Task Act() - => await That(subject).IsNotEqualTo(ununexpected); + => await That(subject).IsNotEqualTo(unexpected); await That(Act).DoesNotThrow(); } [Fact] - public async Task WhenUnunexpectedIsNull_ShouldSucceed() + public async Task WhenUnexpectedIsNull_ShouldSucceed() { string subject = "some text"; - string? ununexpected = null; + string? unexpected = null; async Task Act() - => await That(subject).IsNotEqualTo(ununexpected); + => await That(subject).IsNotEqualTo(unexpected); await That(Act).DoesNotThrow(); } @@ -51,10 +51,10 @@ async Task Act() public async Task WhenStringHasMissingLeadingWhitespace_ShouldSucceed() { string subject = "some text"; - string ununexpected = " \t some text"; + string unexpected = " \t some text"; async Task Act() - => await That(subject).IsNotEqualTo(ununexpected); + => await That(subject).IsNotEqualTo(unexpected); await That(Act).DoesNotThrow(); } @@ -63,34 +63,34 @@ async Task Act() public async Task WhenStringHasMissingTrailingWhitespace_ShouldSucceed() { string subject = "some text"; - string ununexpected = "some text \t "; + string unexpected = "some text \t "; async Task Act() - => await That(subject).IsNotEqualTo(ununexpected); + => await That(subject).IsNotEqualTo(unexpected); await That(Act).DoesNotThrow(); } [Fact] - public async Task WhenStringHasUnunexpectedLeadingWhitespace_ShouldSucceed() + public async Task WhenStringHasUnexpectedLeadingWhitespace_ShouldSucceed() { string subject = " \t some text"; - string ununexpected = "some text"; + string unexpected = "some text"; async Task Act() - => await That(subject).IsNotEqualTo(ununexpected); + => await That(subject).IsNotEqualTo(unexpected); await That(Act).DoesNotThrow(); } [Fact] - public async Task WhenStringHasUnunexpectedTrailingWhitespace_ShouldSucceed() + public async Task WhenStringHasUnexpectedTrailingWhitespace_ShouldSucceed() { string subject = "some text \t "; - string ununexpected = "some text"; + string unexpected = "some text"; async Task Act() - => await That(subject).IsNotEqualTo(ununexpected); + => await That(subject).IsNotEqualTo(unexpected); await That(Act).DoesNotThrow(); } diff --git a/Tests/aweXpect.Tests/Strings/ThatString.StartsWith.Tests.cs b/Tests/aweXpect.Tests/Strings/ThatString.StartsWith.Tests.cs index a0ca21338..597c27d05 100644 --- a/Tests/aweXpect.Tests/Strings/ThatString.StartsWith.Tests.cs +++ b/Tests/aweXpect.Tests/Strings/ThatString.StartsWith.Tests.cs @@ -13,7 +13,7 @@ public async Task IgnoringCase_WhenSubjectStartsWithDifferentCase_ShouldFailUnlessCaseIsIgnored( bool ignoreCase) { - string subject = "some arbitrary text"; + string subject = "Some arbitrary text"; string expected = "SOME"; async Task Act() @@ -25,7 +25,14 @@ await That(Act).Throws() .WithMessage(""" Expected that subject starts with "SOME", - but it was "some arbitrary text" + but it was "Some arbitrary text" which differs at index 1: + ↓ (actual) + "Some arbitrary text" + "SOME" + ↑ (expected) + + Actual: + Some arbitrary text """); } @@ -43,7 +50,14 @@ await That(Act).Throws() .WithMessage(""" Expected that subject starts with "TEXT" ignoring case, - but it was "some arbitrary text" + but it was "some arbitrary text" which differs at index 0: + ↓ (actual) + "some arbitrary text" + "TEXT" + ↑ (expected) + + Actual: + some arbitrary text """); } @@ -62,7 +76,14 @@ await That(Act).Throws() .WithMessage(""" Expected that subject starts with "SOME" using IgnoreCaseForVocalsComparer, - but it was "some arbitrary text" + but it was "some arbitrary text" which differs at index 0: + ↓ (actual) + "some arbitrary text" + "SOME" + ↑ (expected) + + Actual: + some arbitrary text """); } @@ -93,7 +114,10 @@ await That(Act).Throws() .WithMessage(""" Expected that subject starts with , - but "text" cannot be validated against + but it was "text" + + Actual: + text """); } @@ -110,7 +134,14 @@ await That(Act).Throws() .WithMessage(""" Expected that subject starts with "text", - but it was "some arbitrary text" + but it was "some arbitrary text" which differs at index 0: + ↓ (actual) + "some arbitrary text" + "text" + ↑ (expected) + + Actual: + some arbitrary text """); } @@ -156,7 +187,11 @@ await That(Act).Throws() .WithMessage(""" Expected that subject starts with "text and more", - but it was "text" and with length 4 is shorter than the expected length of 13 + but it was "text" with a length of 4 which is shorter than the expected length of 13 and misses: + " and more" + + Actual: + text """); }