Beispiel #1
0
    public void ShouldThrowOnInvalidSliceArguments(int start, int length)
    {
        // Arrange
        var array = new[] { new TestEvent(), new TestEvent(), new TestEvent() };
        var batch = new EventBatch <TestEvent>(array, 0, 3);

        // Act/Assert
        Assert.Throws <ArgumentOutOfRangeException>(() => batch.Slice(start, length));
    }
Beispiel #2
0
    public void ShouldGetSlice(int start, int length)
    {
        // Arrange
        var array = new[] { new TestEvent(), new TestEvent(), new TestEvent() };
        var batch = new EventBatch <TestEvent>(array, 0, 3);

        // Act
        var slice = batch.Slice(start, length);

        // Assert
        Assert.AreEqual(batch.AsSpan().Slice(start, length).ToArray(), slice.ToArray());
    }