public void StringBuffer_Rewind() { StringBuffer buffer = new StringBuffer("Hello World"); Assert.IsTrue(buffer.Seek(6)); Assert.AreEqual(6, buffer.Position); buffer.Rewind(); Assert.AreEqual(0, buffer.Position); }
public void StringBuffer_Seek() { StringBuffer buffer = new StringBuffer("Hello World"); Assert.IsTrue(buffer.Seek(6)); Assert.AreEqual('W', (char)buffer.Read()); Assert.AreEqual('o', (char)buffer.Read()); Assert.AreEqual('r', (char)buffer.Read()); Assert.AreEqual('l', (char)buffer.Read()); Assert.AreEqual('d', (char)buffer.Read()); Assert.IsTrue(buffer.Seek(0)); Assert.AreEqual('H', (char)buffer.Read()); Assert.AreEqual('e', (char)buffer.Read()); Assert.AreEqual('l', (char)buffer.Read()); Assert.AreEqual('l', (char)buffer.Read()); Assert.AreEqual('o', (char)buffer.Read()); Assert.IsFalse(buffer.Seek(-1)); Assert.IsFalse(buffer.Seek(12)); Assert.IsFalse(buffer.Seek(11)); }