public void TestRead2() { const string s = "hello"; using (var reader = new StackBufferedTextReader(new StringReader(s))) { var buffer = new char[4]; Assert.That(reader.Read(buffer, 0, buffer.Length), Is.EqualTo(buffer.Length)); Assert.That(new string(buffer), Is.EqualTo("hell")); Assert.That(reader.Read(buffer, 2, 2), Is.EqualTo(1)); Assert.That(new string(buffer)[2], Is.EqualTo('o')); } }
public void TestRead1() { const string s = "hello"; using (var reader = new StackBufferedTextReader(new StringReader(s))) { Assert.That(reader.Read(), Is.EqualTo((int)'h')); Assert.That(reader.Read(), Is.EqualTo((int)'e')); Assert.That(reader.Read(), Is.EqualTo((int)'l')); Assert.That(reader.Read(), Is.EqualTo((int)'l')); Assert.That(reader.Read(), Is.EqualTo((int)'o')); Assert.That(reader.Read(), Is.EqualTo(-1)); } }