From 0285cbd3fa4ab398299cc8da44e7e60d4b808e7c Mon Sep 17 00:00:00 2001 From: Christian Bergum Bergersen Date: Mon, 9 Sep 2024 19:18:28 +0200 Subject: [PATCH] Fixes JasperFx/alba#171 --- src/Alba.Testing/Assertions/BodyTextAssertionTests.cs | 2 +- src/Alba/Assertions/BodyTextAssertion.cs | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Alba.Testing/Assertions/BodyTextAssertionTests.cs b/src/Alba.Testing/Assertions/BodyTextAssertionTests.cs index 1b8c7e4b..a9a2ee1d 100644 --- a/src/Alba.Testing/Assertions/BodyTextAssertionTests.cs +++ b/src/Alba.Testing/Assertions/BodyTextAssertionTests.cs @@ -19,7 +19,7 @@ public void sad_path() { var assertion = new BodyTextAssertion("Hey!"); AssertionRunner.Run(assertion, env => env.Response.Write("Hey! You!")) - .Messages.Single().ShouldContain("Expected the content to be 'Hey!'"); + .Messages.Single().ShouldBe("Expected the content to be 'Hey!', but was 'Hey! You!'"); } } } \ No newline at end of file diff --git a/src/Alba/Assertions/BodyTextAssertion.cs b/src/Alba/Assertions/BodyTextAssertion.cs index 8e2de8f5..60bcee62 100644 --- a/src/Alba/Assertions/BodyTextAssertion.cs +++ b/src/Alba/Assertions/BodyTextAssertion.cs @@ -1,5 +1,3 @@ -using Microsoft.AspNetCore.Http; - namespace Alba.Assertions; internal sealed class BodyTextAssertion : IScenarioAssertion @@ -16,7 +14,7 @@ public void Assert(Scenario scenario, AssertionContext context) var body = context.ReadBodyAsString(); if (!body.Equals(Text)) { - context.AddFailure($"Expected the content to be '{Text}'"); + context.AddFailure($"Expected the content to be '{Text}', but was '{body}'"); } } } \ No newline at end of file