Exemplo n.º 1
0
        public void ShouldReadAndSeel()
        {
            ICharReader reader;

            reader = new StringCharReader("Welcome");
            Assert.AreEqual('W', reader.Read());
            Assert.AreEqual('e', reader.Read());
            Assert.AreEqual('l', reader.Read());
            reader.Seek(0);
            Assert.AreEqual('W', reader.Read());
            Assert.AreEqual('e', reader.Read());
            Assert.AreEqual('l', reader.Read());
        }
Exemplo n.º 2
0
        public void ShouldReturnEOF()
        {
            ICharReader reader;

            reader = new StringCharReader("Welcome");
            Assert.IsFalse(reader.EOF);
            Assert.AreEqual('W', reader.Read());
            Assert.IsFalse(reader.EOF);
            Assert.AreEqual('e', reader.Read());
            Assert.IsFalse(reader.EOF);
            Assert.AreEqual('l', reader.Read());
            Assert.IsFalse(reader.EOF);
            Assert.AreEqual('c', reader.Read());
            Assert.IsFalse(reader.EOF);
            Assert.AreEqual('o', reader.Read());
            Assert.IsFalse(reader.EOF);
            Assert.AreEqual('m', reader.Read());
            Assert.IsFalse(reader.EOF);
            Assert.AreEqual('e', reader.Read());
            Assert.IsTrue(reader.EOF);
        }
Exemplo n.º 3
0
        public void ShouldReadCharacters()
        {
            ICharReader reader;

            reader = new StringCharReader("Welcome");
            Assert.AreEqual(0, reader.Position);
            Assert.AreEqual('W', reader.Read());
            Assert.AreEqual(1, reader.Position);
            Assert.AreEqual('e', reader.Read());
            Assert.AreEqual(2, reader.Position);
            Assert.AreEqual('l', reader.Read());
            Assert.AreEqual(3, reader.Position);
            Assert.AreEqual('c', reader.Read());
            Assert.AreEqual(4, reader.Position);
            Assert.AreEqual('o', reader.Read());
            Assert.AreEqual(5, reader.Position);
            Assert.AreEqual('m', reader.Read());
            Assert.AreEqual(6, reader.Position);
            Assert.AreEqual('e', reader.Read());
            Assert.AreEqual(7, reader.Position);
        }