From c6af9d6313c18697a3234dd8dc78fed43b688daf Mon Sep 17 00:00:00 2001 From: Cervac Petru Date: Mon, 16 Oct 2023 09:32:01 +0100 Subject: [PATCH 1/2] chore: capitalize true and false Display 'true' and 'false' as capitalized rathen than in lowercase so that both expected value and actual value uses the same casing. ---Before--- "Expected boolean to be false, but found True." ---After--- "Expected boolean to be False, but found True." --- Src/FluentAssertions/Primitives/BooleanAssertions.cs | 4 ++-- .../Primitives/BooleanAssertionSpecs.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Src/FluentAssertions/Primitives/BooleanAssertions.cs b/Src/FluentAssertions/Primitives/BooleanAssertions.cs index 489aac2e37..393909249e 100644 --- a/Src/FluentAssertions/Primitives/BooleanAssertions.cs +++ b/Src/FluentAssertions/Primitives/BooleanAssertions.cs @@ -51,7 +51,7 @@ public AndConstraint BeFalse(string because = "", params object[] b Execute.Assertion .ForCondition(Subject == false) .BecauseOf(because, becauseArgs) - .FailWith("Expected {context:boolean} to be false{reason}, but found {0}.", Subject); + .FailWith("Expected {context:boolean} to be False{reason}, but found {0}.", Subject); return new AndConstraint((TAssertions)this); } @@ -71,7 +71,7 @@ public AndConstraint BeTrue(string because = "", params object[] be Execute.Assertion .ForCondition(Subject == true) .BecauseOf(because, becauseArgs) - .FailWith("Expected {context:boolean} to be true{reason}, but found {0}.", Subject); + .FailWith("Expected {context:boolean} to be True{reason}, but found {0}.", Subject); return new AndConstraint((TAssertions)this); } diff --git a/Tests/FluentAssertions.Specs/Primitives/BooleanAssertionSpecs.cs b/Tests/FluentAssertions.Specs/Primitives/BooleanAssertionSpecs.cs index f956cb55af..63e8cf8cb5 100644 --- a/Tests/FluentAssertions.Specs/Primitives/BooleanAssertionSpecs.cs +++ b/Tests/FluentAssertions.Specs/Primitives/BooleanAssertionSpecs.cs @@ -41,7 +41,7 @@ public void Should_fail_with_descriptive_message_when_asserting_boolean_value_fa // Assert action .Should().Throw() - .WithMessage("Expected boolean to be true because we want to test the failure message, but found False."); + .WithMessage("Expected boolean to be True because we want to test the failure message, but found False."); } } @@ -78,7 +78,7 @@ public void Should_fail_with_descriptive_message_when_asserting_boolean_value_tr // Assert action.Should().Throw() - .WithMessage("Expected boolean to be false because we want to test the failure message, but found True."); + .WithMessage("Expected boolean to be False because we want to test the failure message, but found True."); } } From 24bcbb1afac061898e8864768d66672e4ce4a193 Mon Sep 17 00:00:00 2001 From: Cervac Petru Date: Tue, 17 Oct 2023 19:26:58 +0100 Subject: [PATCH 2/2] docs: update releases.md --- docs/_pages/releases.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_pages/releases.md b/docs/_pages/releases.md index b63bca7de2..4f3b2877d3 100644 --- a/docs/_pages/releases.md +++ b/docs/_pages/releases.md @@ -21,7 +21,7 @@ sidebar: * Fixed that the `because` and `becauseArgs` were not passed down the equivalency tree - [#2318](https://github.com/fluentassertions/fluentassertions/pull/2318) * `BeEquivalentTo` can again compare a non-generic `IDictionary` with a generic one - [#2358](https://github.com/fluentassertions/fluentassertions/pull/23158) * Fixed that the `FormattingOptions` were not respected in inner `AssertionScope` - [#2328](https://github.com/fluentassertions/fluentassertions/pull/2328) - +* Capitalize `true` and `false` in failure messages - [#2390](https://github.com/fluentassertions/fluentassertions/pull/2390) ### Breaking Changes (for users) * Moved support for `DataSet`, `DataTable`, `DataRow` and `DataColumn` into a new package `FluentAssertions.DataSet` - [#2267](https://github.com/fluentassertions/fluentassertions/pull/2267)