Skip to content

Commit 8716307

Browse files
committed
No more exceptions on ToArray(length) extension test
1 parent aa2ff2a commit 8716307

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Orm/Xtensive.Orm.Tests.Core/Collections/EnumerableExtensionsTest.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,14 @@ public void ToArrayCountTest()
172172
Assert.That(array.Length, Is.EqualTo(10));
173173
Assert.That(array.All(x => x == 1));
174174

175-
_ = Assert.Throws<ArgumentOutOfRangeException>(() => Enumerable.Repeat(1, 10).ToArray(11));
176-
_ = Assert.Throws<ArgumentOutOfRangeException>(() => Enumerable.Repeat(1, 10).ToArray(9));
175+
array = Enumerable.Repeat(1, 10).ToArray(11);
176+
Assert.That(array.Length, Is.EqualTo(11));
177+
Assert.That(array.Take(10).All(x => x == 1));
178+
Assert.That(array[10], Is.Not.EqualTo(1));
179+
180+
array = Enumerable.Repeat(1, 10).ToArray(9);
181+
Assert.That(array.Length, Is.EqualTo(9));
182+
Assert.That(array.All(x => x == 1));
177183
}
178184

179185
[Test]

0 commit comments

Comments
 (0)