Improve Skip coverage

This commit is contained in:
Ben Adams 2016-11-19 14:15:37 +00:00
parent ba0b7cc553
commit 9ec4d88fbe
1 changed files with 13 additions and 8 deletions

View File

@ -518,20 +518,25 @@ namespace Microsoft.AspNetCore.Server.KestrelTests
public void SkipThrowsWhenSkippingMoreBytesThanAvailableInMultipleBlocks()
{
// Arrange
var block = _pool.Lease();
block.End += 3;
var firstBlock = _pool.Lease();
firstBlock.End += 3;
var nextBlock = _pool.Lease();
nextBlock.End += 2;
block.Next = nextBlock;
var middleBlock = _pool.Lease();
middleBlock.End += 1;
firstBlock.Next = middleBlock;
var scan = block.GetIterator();
var finalBlock = _pool.Lease();
finalBlock.End += 2;
middleBlock.Next = finalBlock;
var scan = firstBlock.GetIterator();
// Act/Assert
Assert.ThrowsAny<InvalidOperationException>(() => scan.Skip(8));
_pool.Return(block);
_pool.Return(nextBlock);
_pool.Return(firstBlock);
_pool.Return(middleBlock);
_pool.Return(finalBlock);
}
[Theory]