public void TestBatch() { Assert.Throws <ArgumentNullException>(() => EnumerableExtensions.Batch <object>(null, 1).ToArray()); Assert.Throws <ArgumentOutOfRangeException>(() => EnumerableExtensions.Batch(new object[0], -1).ToArray()); var list = new List <int> { 1, 2, 3, 4, 5, 6, 7 }; CollectionAssert.AreEquivalent(new[] { new[] { 1, 2, 3 }, new[] { 4, 5, 6 }, new[] { 7 } }, list.Batch(3)); }