public void GetBoundedSlice_WhenArgsAreCorrect(long totalLength, int bufferLength, long start, int length) { using MemoryGroup <int> group = this.CreateTestGroup(totalLength, bufferLength, true); Memory <int> slice = group.GetBoundedSlice(start, length); Assert.Equal(length, slice.Length); int expected = (int)start + 1; foreach (int val in slice.Span) { Assert.Equal(expected, val); expected++; } }
public void GetBoundedSlice_WhenOverlapsBuffers_Throws(long totalLength, int bufferLength, long start, int length) { using MemoryGroup <int> group = this.CreateTestGroup(totalLength, bufferLength, true); Assert.ThrowsAny <ArgumentOutOfRangeException>(() => group.GetBoundedSlice(start, length)); }