コード例 #1
0
ファイル: StringreaderTest.cs プロジェクト: achernet/Serpent
        public void TestNesting()
        {
            SeekableStringReader outer = new SeekableStringReader("hello!");

            outer.Read(1);
            SeekableStringReader inner1 = new SeekableStringReader(outer);
            SeekableStringReader inner2 = new SeekableStringReader(outer);

            Assert.AreEqual("ell", inner1.Read(3));
            Assert.AreEqual("el", inner2.Read(2));
            Assert.AreEqual("o", inner1.Read(1));
            Assert.AreEqual("l", inner2.Read(1));
            Assert.AreEqual("e", outer.Read(1));
            Assert.AreEqual("o", inner2.Read(1));
            Assert.AreEqual("l", outer.Read(1));
            outer.Sync(inner2);
            Assert.AreEqual("!", outer.Read(1));
        }