Skip to content

Commit bbda725

Browse files
committed
Fix unordered enumerable tests
1 parent 4d9444e commit bbda725

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

BitFaster.Caching.UnitTests/Lru/ConcurrentLruTests.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public void WhenItemsAddedKeysContainsTheKeys()
143143
lru.Count.ShouldBe(0);
144144
lru.GetOrAdd(1, valueFactory.Create);
145145
lru.GetOrAdd(2, valueFactory.Create);
146-
lru.Keys.ShouldBe(new[] { 1, 2 });
146+
lru.Keys.ShouldBe(new[] { 1, 2 }, ignoreOrder: true);
147147
}
148148

149149
[Fact]
@@ -152,7 +152,7 @@ public void WhenItemsAddedGenericEnumerateContainsKvps()
152152
lru.Count.ShouldBe(0);
153153
lru.GetOrAdd(1, valueFactory.Create);
154154
lru.GetOrAdd(2, valueFactory.Create);
155-
lru.ShouldBe(new[] { new KeyValuePair<int, string>(1, "1"), new KeyValuePair<int, string>(2, "2") });
155+
lru.ShouldBe(new[] { new KeyValuePair<int, string>(1, "1"), new KeyValuePair<int, string>(2, "2") }, ignoreOrder: true);
156156
}
157157

158158
[Fact]
@@ -162,8 +162,9 @@ public void WhenItemsAddedEnumerateContainsKvps()
162162
lru.GetOrAdd(1, valueFactory.Create);
163163
lru.GetOrAdd(2, valueFactory.Create);
164164

165-
var enumerable = (IEnumerable)lru;
166-
enumerable.ShouldBe(new[] { new KeyValuePair<int, string>(1, "1"), new KeyValuePair<int, string>(2, "2") });
165+
var untypedEnumerable = (IEnumerable)lru;
166+
var enumerable = untypedEnumerable.Cast<KeyValuePair<int, string>>();
167+
enumerable.ShouldBe(new[] { new KeyValuePair<int, string>(1, "1"), new KeyValuePair<int, string>(2, "2") }, ignoreOrder: true);
167168
}
168169

169170
[Fact]

0 commit comments

Comments
 (0)