public void ShouldReturnNullWhenPeekingAfterTheLastItem() { var items = new List <object> { 1 }; var tokenizableStreamBase = new TokenizableStreamBase <object>(() => items); Assert.AreEqual(1, tokenizableStreamBase.Current); Assert.IsNull(tokenizableStreamBase.Peek()); Assert.IsNull(tokenizableStreamBase.Peek(3)); }
public void ShouldBeAbleToPeekAtFutureItems() { var items = new List <object> { 1, 2, 3, 4, 5, 6 }; var tokenizableStreamBase = new TokenizableStreamBase <object>(() => items); Assert.AreEqual(1, tokenizableStreamBase.Current); Assert.AreEqual(4, tokenizableStreamBase.Peek(3)); Assert.AreEqual(6, tokenizableStreamBase.Peek(5)); }
public void ShouldBeAbleToPeekAtTheNextItem() { var items = new List <object> { 1, 2 }; var tokenizableStreamBase = new TokenizableStreamBase <object>(() => items); Assert.AreEqual(1, tokenizableStreamBase.Current); Assert.AreEqual(2, tokenizableStreamBase.Peek()); }
public void ShouldBeaBleToPeekWithoutConsumingTheCurrentItem() { var items = new List <object> { 1, 2 }; var tokenizableStreamBase = new TokenizableStreamBase <object>(() => items); Assert.AreEqual(1, tokenizableStreamBase.Current); Assert.AreEqual(2, tokenizableStreamBase.Peek()); Assert.AreEqual(1, tokenizableStreamBase.Current); }