From 97cf254185c3a33f38b0bf97016674cf56e2d9b6 Mon Sep 17 00:00:00 2001 From: Koen Metsu Date: Wed, 15 Nov 2023 10:38:06 +0100 Subject: [PATCH] fix: or-1759 compare case sensitive --- .../Framework/CaseSensitiveComparer.cs | 7 +++++++ .../With_Sorting/Given_Sort_By_SingleField.cs | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 test/AssociationRegistry.Test.Public.Api/Framework/CaseSensitiveComparer.cs diff --git a/test/AssociationRegistry.Test.Public.Api/Framework/CaseSensitiveComparer.cs b/test/AssociationRegistry.Test.Public.Api/Framework/CaseSensitiveComparer.cs new file mode 100644 index 000000000..c9c8b7b30 --- /dev/null +++ b/test/AssociationRegistry.Test.Public.Api/Framework/CaseSensitiveComparer.cs @@ -0,0 +1,7 @@ +namespace AssociationRegistry.Test.Public.Api.Framework; + +public class CaseSensitiveComparer : IComparer +{ + public int Compare(string? x, string? y) + => string.Compare(x, y, StringComparison.Ordinal); +} diff --git a/test/AssociationRegistry.Test.Public.Api/When_Searching/With_Sorting/Given_Sort_By_SingleField.cs b/test/AssociationRegistry.Test.Public.Api/When_Searching/With_Sorting/Given_Sort_By_SingleField.cs index 6b18b970e..19d43b60e 100644 --- a/test/AssociationRegistry.Test.Public.Api/When_Searching/With_Sorting/Given_Sort_By_SingleField.cs +++ b/test/AssociationRegistry.Test.Public.Api/When_Searching/With_Sorting/Given_Sort_By_SingleField.cs @@ -3,6 +3,7 @@ namespace AssociationRegistry.Test.Public.Api.When_Searching.With_Sorting; using Fixtures; using Fixtures.GivenEvents; using FluentAssertions; +using Framework; using Newtonsoft.Json.Linq; using Xunit; using Xunit.Abstractions; @@ -39,7 +40,7 @@ public Given_Sort_By_SingleField(GivenEventsFixture fixture, ITestOutputHelper h .ToList(); names.Should().NotBeEmpty(); - names.Should().BeInAscendingOrder(); + names.Should().BeInAscendingOrder(new CaseSensitiveComparer()); names.ForEach(_outputHelper.WriteLine); } @@ -59,7 +60,7 @@ public Given_Sort_By_SingleField(GivenEventsFixture fixture, ITestOutputHelper h .ToList(); names.Should().NotBeEmpty(); - names.Should().BeInDescendingOrder(); + names.Should().BeInDescendingOrder(new CaseSensitiveComparer()); names.ForEach(_outputHelper.WriteLine); } }