public void TokenBuffer_Seek() { Buffer<FormatToken> buffer = new FormatTokenBuffer(new List<FormatToken> { FormatToken.CreateLiteral("Hello World"), FormatToken.CreateSymbol('@') }); Assert.AreEqual(0, buffer.Position); Assert.AreEqual("Hello World", buffer.Read().Value); Assert.AreEqual(1, buffer.Position); Assert.IsTrue(buffer.Seek(0)); Assert.AreEqual(0, buffer.Position); Assert.IsFalse(buffer.Seek(2)); Assert.AreEqual(0, buffer.Position); }
public void TokenBuffer_Rewind() { Buffer<FormatToken> buffer = new FormatTokenBuffer(new List<FormatToken> { FormatToken.CreateLiteral("Hello World"), FormatToken.CreateSymbol('@'), FormatToken.CreateWhitespace('\t') }); buffer.Seek(2); Assert.AreEqual(2, buffer.Position); buffer.Rewind(); Assert.AreEqual(0, buffer.Position); }