OSDN Git Service

LRUCacheDictionaryのテストにAssert.Containsを使用しない
authorKimura Youichi <kim.upsilon@bucyou.net>
Wed, 6 Dec 2023 18:50:12 +0000 (03:50 +0900)
committerKimura Youichi <kim.upsilon@bucyou.net>
Wed, 6 Dec 2023 18:54:25 +0000 (03:54 +0900)
ICollection<KeyValuePair<string, string>>.Contains() の実装をテストすることができないため

OpenTween.Tests/LRUCacheDictionaryTest.cs

index d9d56bd..b921fce 100644 (file)
@@ -223,10 +223,12 @@ namespace OpenTween
                 ["key3"] = "value3",
             };
 
-            Assert.Contains(new KeyValuePair<string, string>("key1", "value1"), dict);
-            Assert.DoesNotContain(new KeyValuePair<string, string>("key3", "value2"), dict);
-            Assert.DoesNotContain(new KeyValuePair<string, string>("value3", "key3"), dict);
-            Assert.DoesNotContain(new KeyValuePair<string, string>("hogehoge", "hogehoge"), dict);
+#pragma warning disable xUnit2017
+            Assert.True(dict.Contains(new("key1", "value1")));
+            Assert.False(dict.Contains(new("key3", "value2")));
+            Assert.False(dict.Contains(new("value3", "key3")));
+            Assert.False(dict.Contains(new("hogehoge", "hogehoge")));
+#pragma warning restore xUnit2017
         }
 
         [Fact]