mirror of
https://github.com/BepInEx/dotnet-runtime.git
synced 2026-11-22 19:10:41 -10:00
* Add System.Linq Chunk extension method Fix #27449 * Use explicit types instead of type inference * Seperate inner and outer loop * Rename parameter maxSize to size * Add missing license header * Remove Chunk.SpeedOpt.cs * Add tests to verify Chunk works after mutations * Add/remove before getting enumerator in tests * Test content of chunk method for IQueryable<T>
26 lines
715 B
C#
26 lines
715 B
C#
// Licensed to the .NET Foundation under one or more agreements.
|
|
// The .NET Foundation licenses this file to you under the MIT license.
|
|
|
|
using Xunit;
|
|
|
|
namespace System.Linq.Tests
|
|
{
|
|
public class ChunkTests : EnumerableBasedTests
|
|
{
|
|
[Fact]
|
|
public void ThrowsOnNullSource()
|
|
{
|
|
IQueryable<int> source = null;
|
|
AssertExtensions.Throws<ArgumentNullException>("source", () => source.Chunk(5));
|
|
}
|
|
|
|
[Fact]
|
|
public void Chunk()
|
|
{
|
|
var chunked = new[] {0, 1, 2}.AsQueryable().Chunk(2);
|
|
|
|
Assert.Equal(2, chunked.Count());
|
|
Assert.Equal(new[] {new[] {0, 1}, new[] {2}}, chunked);
|
|
}
|
|
}
|
|
} |