Skip to content

Commit acb94ea

Browse files
committed
revert analyzer fixes in OrderedDictionaryTest
1 parent 1af5e5d commit acb94ea

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

test/Renci.SshNet.Tests/Classes/OrderedDictionaryTest.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System;
1+
#pragma warning disable MSTEST0037 // Use proper 'Assert' methods
2+
using System;
23
using System.Collections.Generic;
34
using System.Linq;
45

@@ -28,11 +29,11 @@ private static void AssertEqual<TKey, TValue>(List<KeyValuePair<TKey, TValue>> e
2829
Assert.AreEqual(expected[i].Value, value);
2930
Assert.AreEqual(i, index);
3031

31-
Assert.Contains(expected[i], o);
32+
Assert.IsTrue(((ICollection<KeyValuePair<TKey, TValue>>)o).Contains(expected[i]));
3233
Assert.IsTrue(o.ContainsKey(expected[i].Key));
3334
Assert.IsTrue(o.ContainsValue(expected[i].Value));
34-
Assert.Contains(expected[i].Key, o.Keys);
35-
Assert.Contains(expected[i].Value, o.Values);
35+
Assert.IsTrue(o.Keys.Contains(expected[i].Key));
36+
Assert.IsTrue(o.Values.Contains(expected[i].Value));
3637

3738
Assert.AreEqual(i, o.IndexOf(expected[i].Key));
3839

@@ -41,11 +42,11 @@ private static void AssertEqual<TKey, TValue>(List<KeyValuePair<TKey, TValue>> e
4142
Assert.AreEqual(i, index);
4243
}
4344

44-
Assert.HasCount(expected.Count, o.Keys);
45+
Assert.AreEqual(expected.Count, o.Keys.Count);
4546
CollectionAssert.AreEqual(expected.Select(kvp => kvp.Key).ToList(), ToList(o.Keys));
4647
CollectionAssert.AreEqual(ToList(o.Keys), ToList(((IReadOnlyDictionary<TKey, TValue>)o).Keys));
4748

48-
Assert.HasCount(expected.Count, o.Values);
49+
Assert.AreEqual(expected.Count, o.Values.Count);
4950
CollectionAssert.AreEqual(expected.Select(kvp => kvp.Value).ToList(), ToList(o.Values));
5051
CollectionAssert.AreEqual(ToList(o.Values), ToList(((IReadOnlyDictionary<TKey, TValue>)o).Values));
5152

@@ -185,8 +186,8 @@ public void ContainsKvp_ChecksKeyAndValue()
185186
{
186187
OrderedDictionary<string, int> o = new() { { "a", 4 } };
187188

188-
Assert.DoesNotContain(new KeyValuePair<string, int>("a", 8), o);
189-
Assert.Contains(new KeyValuePair<string, int>("a", 4), o);
189+
Assert.IsFalse(((ICollection<KeyValuePair<string, int>>)o).Contains(new KeyValuePair<string, int>("a", 8)));
190+
Assert.IsTrue(((ICollection<KeyValuePair<string, int>>)o).Contains(new KeyValuePair<string, int>("a", 4)));
190191
}
191192

192193
[TestMethod]
@@ -288,7 +289,7 @@ public void Get_NonExistent()
288289
OrderedDictionary<string, float> o = new() { { "a", 4 } };
289290

290291
Assert.ThrowsExactly<KeyNotFoundException>(() => o["doesn't exist"]);
291-
Assert.DoesNotContain(new KeyValuePair<string, float>("doesn't exist", 1), o);
292+
Assert.IsFalse(((ICollection<KeyValuePair<string, float>>)o).Contains(new KeyValuePair<string, float>("doesn't exist", 1)));
292293
Assert.IsFalse(o.ContainsKey("doesn't exist"));
293294
Assert.IsFalse(o.ContainsValue(999));
294295
Assert.AreEqual(-1, o.IndexOf("doesn't exist"));

0 commit comments

Comments
 (0)