From 8a8baf5a0254754399d1893ab0825eb43e191c28 Mon Sep 17 00:00:00 2001 From: Atif Aziz Date: Thu, 3 Nov 2022 21:52:41 +0100 Subject: [PATCH] Cover new dictionary code --- MoreLinq.Test/CountByTest.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/MoreLinq.Test/CountByTest.cs b/MoreLinq.Test/CountByTest.cs index 26158260d..ea0e7e8a1 100644 --- a/MoreLinq.Test/CountByTest.cs +++ b/MoreLinq.Test/CountByTest.cs @@ -103,5 +103,17 @@ public void CountByWithSomeNullKeys() KeyValuePair.Create("bar", 2), KeyValuePair.Create("baz", 2)); } + + [Test] + public void CountByWithSomeNullKeysAndEqualityComparer() + { + var result = new[] { "a", "B", null, "c", "A", null, "b", "A" }.CountBy(c => c, StringComparer.OrdinalIgnoreCase); + + result.AssertSequenceEqual( + KeyValuePair.Create("a", 3), + KeyValuePair.Create("B", 2), + KeyValuePair.Create((string)null, 2), + KeyValuePair.Create("c", 1)); + } } }