public void Peek_And_Read_Works_As_Expected_Without_Altering_StringBuilder() { var sb = new StringBuilder("T"); using (var sbreader = new SbReader(sb)) { Assert.True(sbreader.Peek().Equals('T')); Assert.True(sbreader.Read().Equals('T')); Assert.True(sbreader.Peek().Equals(-1)); Assert.True(sbreader.Read().Equals(-1)); } Assert.True(sb.ToString().Equals("T")); }
public void Buffered_Read_Works_As_Expected_Without_Altering_StringBuilder(int buffSize) { var sb = new StringBuilder("Ttt"); var chars = new char[buffSize]; using (var sbreader = new SbReader(sb)) { Assert.True(sbreader.Read(chars, 0, buffSize).Equals(Math.Min(3, buffSize))); Assert.True(chars[0].Equals('T')); } Assert.True(sb.ToString().Equals("Ttt")); }