public void LookAheadOne() { StringReader reader = new StringReader("Test"); ScanningTextReader scanningReader = new ScanningTextReader(reader); Assert.AreEqual('T', scanningReader.LookAhead(0)); Assert.AreEqual('T', scanningReader.Read()); Assert.AreEqual('e', scanningReader.Read()); Assert.AreEqual('s', scanningReader.LookAhead(0)); Assert.AreEqual('s', scanningReader.Read()); Assert.AreEqual('t', scanningReader.Read()); }
public void PeekWithLookahead() { StringReader reader = new StringReader("Test"); ScanningTextReader scanningReader = new ScanningTextReader(reader); Assert.AreEqual('T', scanningReader.LookAhead(0)); Assert.AreEqual('s', scanningReader.LookAhead(2)); Assert.AreEqual('T', scanningReader.Peek()); Assert.AreEqual('T', scanningReader.Read()); Assert.AreEqual('e', scanningReader.Read()); Assert.AreEqual('s', scanningReader.LookAhead(0)); Assert.AreEqual('s', scanningReader.Peek()); Assert.AreEqual("st", scanningReader.ReadToEnd()); }
public void PeekWithoutLookahead() { StringReader reader = new StringReader("Test"); ScanningTextReader scanningReader = new ScanningTextReader(reader); Assert.AreEqual('T', scanningReader.Peek()); Assert.AreEqual('T', scanningReader.Read()); Assert.AreEqual('e', scanningReader.Peek()); }
public void ValidatePosition() { StringReader reader = new StringReader("Test"); ScanningTextReader scanningReader = new ScanningTextReader(reader); Assert.AreEqual(-1, scanningReader.Position); scanningReader.Read(); Assert.AreEqual(0, scanningReader.Position); scanningReader.Read(); scanningReader.Read(); Assert.AreEqual(2, scanningReader.Position); scanningReader.Read(); Assert.AreEqual(3, scanningReader.Position); scanningReader.Read(); Assert.AreEqual(-1, scanningReader.Position); scanningReader.Read(); scanningReader.Read(); Assert.AreEqual(-1, scanningReader.Position); }
public void ValidatePosition() { StringReader reader = new StringReader("Test"); ScanningTextReader scanningReader = new ScanningTextReader(reader); Assert.AreEqual(-1, scanningReader.Position); scanningReader.Read(); Assert.AreEqual(0, scanningReader.Position); scanningReader.Read(); scanningReader.Read(); Assert.AreEqual(2, scanningReader.Position); scanningReader.Read(); Assert.AreEqual(3, scanningReader.Position); scanningReader.Read(); Assert.AreEqual(-1, scanningReader.Position); scanningReader.Read(); scanningReader.Read(); Assert.AreEqual(-1, scanningReader.Position); }
public void PeekWithLookahead() { StringReader reader = new StringReader("Test"); ScanningTextReader scanningReader = new ScanningTextReader(reader); Assert.AreEqual('T', scanningReader.LookAhead(0)); Assert.AreEqual('s', scanningReader.LookAhead(2)); Assert.AreEqual('T', scanningReader.Peek()); Assert.AreEqual('T', scanningReader.Read()); Assert.AreEqual('e', scanningReader.Read()); Assert.AreEqual('s', scanningReader.LookAhead(0)); Assert.AreEqual('s', scanningReader.Peek()); Assert.AreEqual("st", scanningReader.ReadToEnd()); }
public void PeekWithoutLookahead() { StringReader reader = new StringReader("Test"); ScanningTextReader scanningReader = new ScanningTextReader(reader); Assert.AreEqual('T', scanningReader.Peek()); Assert.AreEqual('T', scanningReader.Read()); Assert.AreEqual('e', scanningReader.Peek()); }
public void LookAheadOne() { StringReader reader = new StringReader("Test"); ScanningTextReader scanningReader = new ScanningTextReader(reader); Assert.AreEqual('T', scanningReader.LookAhead(0)); Assert.AreEqual('T', scanningReader.Read()); Assert.AreEqual('e', scanningReader.Read()); Assert.AreEqual('s', scanningReader.LookAhead(0)); Assert.AreEqual('s', scanningReader.Read()); Assert.AreEqual('t', scanningReader.Read()); }