Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ public ConstraintResult IsMetBy(IDictionary<TKey, TValue>? actual)
{
Actual = actual;
Outcome = actual?.ContainsKey(expected) == true ? Outcome.Success : Outcome.Failure;
expectationBuilder.AddCollectionContext(actual);
if (Outcome != Outcome.Success)
{
expectationBuilder.AddCollectionContext(actual);
Comment thread
vbreuss marked this conversation as resolved.
}

return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,11 @@ public ConstraintResult IsMetBy(IReadOnlyDictionary<TKey, TValue>? actual)
{
Actual = actual;
Outcome = actual?.ContainsKey(expected) == true ? Outcome.Success : Outcome.Failure;
expectationBuilder.AddCollectionContext(actual);
if (Outcome != Outcome.Success)
{
expectationBuilder.AddCollectionContext(actual);
Comment thread
vbreuss marked this conversation as resolved.
}

return this;
}

Expand Down
6 changes: 6 additions & 0 deletions Source/aweXpect/That/Strings/ThatString.IsEqualTo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,13 @@ public async Task<ConstraintResult> IsMetBy(string? actual, CancellationToken ca
if (!string.IsNullOrEmpty(actual))
{
expectationBuilder.AddContext(new ResultContext.Fixed("Actual", actual));

if (Outcome != Outcome.Success && !string.IsNullOrEmpty(expected))
{
expectationBuilder.AddContext(new ResultContext.Fixed("Expected", expected));
}
}

return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,9 @@ Expected that subject

Actual:
bar

Dictionary:
{
[1] = "foo",
[2] = "bar",
[3] = "baz"
}

Expected:
foo
""");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading;

// ReSharper disable PossibleMultipleEnumeration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,8 @@ Expected that subject
Actual:
bar

Dictionary:
{
[1] = "foo",
[2] = "bar",
[3] = "baz"
}
Expected:
foo
""");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ Expected that Delegate

Actual:
ShouldIncludeWhichInErrorMessage

Expected:
foo
""");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ Expected that Delegate

Actual:
foo

Expected:
bar
""");
}

Expand Down
50 changes: 40 additions & 10 deletions Tests/aweXpect.Tests/ExpectTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,18 @@ [03] Expected that subjectC is equal to "subject C"
"subject B"
"subject C"
↑ (expected)

[02] Actual:
subject C


[02] Expected:
subject B

[03] Actual:
subject B

[03] Expected:
subject C
""");
}

Expand Down Expand Up @@ -133,12 +139,18 @@ [04] Expected that subjectC is equal to "subject C"
"subject B"
"subject C"
↑ (expected)

[03] Actual:
some unexpected value


[03] Expected:
subject B

[04] Actual:
subject B

[04] Expected:
subject C
""");
}

Expand Down Expand Up @@ -244,15 +256,24 @@ [03] Expected that subjectC is equal to "subject C"
"subject Z"
"subject C"
↑ (expected)

[01] Actual:
subject X


[01] Expected:
subject A

[02] Actual:
subject Y


[02] Expected:
subject B

[03] Actual:
subject Z

[03] Expected:
subject C
""");
}

Expand Down Expand Up @@ -310,15 +331,24 @@ [01] it was False
"subject Z"
"subject C"
↑ (expected)

[02] Actual:
subject X


[02] Expected:
subject A

[03] Actual:
some unexpected value


[03] Expected:
subject B

[04] Actual:
subject Z

[04] Expected:
subject C
""");
}

Expand Down
12 changes: 12 additions & 0 deletions Tests/aweXpect.Tests/Strings/ThatString.DoesNotEndWith.Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ but it was "some text"

Actual:
some text

Expected:
TEXT
""");
}

Expand Down Expand Up @@ -57,6 +60,9 @@ but it was "some arbitrary text"

Actual:
some arbitrary text

Expected:
tExt
""");
}

Expand Down Expand Up @@ -103,6 +109,9 @@ but it was "some text"

Actual:
some text

Expected:
text
""");
}

Expand Down Expand Up @@ -135,6 +144,9 @@ but it was "some text"

Actual:
some text

Expected:
some text
""");
}

Expand Down
12 changes: 12 additions & 0 deletions Tests/aweXpect.Tests/Strings/ThatString.DoesNotStartWith.Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ but it was "some text"

Actual:
some text

Expected:
some
""");
}

Expand Down Expand Up @@ -71,6 +74,9 @@ but it was "some arbitrary text"

Actual:
some arbitrary text

Expected:
sOmE
""");
}

Expand Down Expand Up @@ -115,6 +121,9 @@ but it was "some text"

Actual:
some text

Expected:
SOME
""");
}

Expand All @@ -135,6 +144,9 @@ but it was "some text"

Actual:
some text

Expected:
some text
""");
}

Expand Down
15 changes: 15 additions & 0 deletions Tests/aweXpect.Tests/Strings/ThatString.EndsWith.Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ Expected that subject

Actual:
some arbitrary text

Expected:
Text
""");
}

Expand All @@ -57,6 +60,9 @@ Expected that subject

Actual:
some arbitrary text

Expected:
SOME
""");
}

Expand All @@ -83,6 +89,9 @@ Expected that subject

Actual:
some arbitrary text

Expected:
Text
""");
}

Expand Down Expand Up @@ -158,6 +167,9 @@ Expected that subject

Actual:
some arbitrary text

Expected:
some
""");
}

Expand Down Expand Up @@ -220,6 +232,9 @@ Expected that subject

Actual:
text

Expected:
more than text
""");
}
}
Expand Down
15 changes: 15 additions & 0 deletions Tests/aweXpect.Tests/Strings/ThatString.IsEqualTo.AsPrefixTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ Expected that subject

Actual:
some text

Expected:
some text
""");
}

Expand All @@ -105,6 +108,9 @@ Expected that subject

Actual:
some text

Expected:
some text
""");
}

Expand All @@ -125,6 +131,9 @@ Expected that subject

Actual:
some text and more

Expected:
some text
""");
}

Expand All @@ -146,6 +155,9 @@ Expected that subject

Actual:
some text with

Expected:
some text without out
""");
}

Expand Down Expand Up @@ -182,6 +194,9 @@ Expected that subject

Actual:
actual text

Expected:
expected other text
""");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ Expected that subject

Actual:
some message

Expected:
.*ME ME.*
""");
}

Expand Down Expand Up @@ -55,6 +58,9 @@ Expected that subject

Actual:
some message

Expected:
.*ME ME.*
""");
}
}
Expand Down
Loading
Loading