Пример #1
0
        public void Peek_and_read_return_characters_and_advance_appropriately()
        {
            var writer = new SpoolWriter();
            writer.Write("ab");
            writer.Write("c");

            var reader = new SpoolReader(writer);
            Assert.That(reader.Peek(), Is.EqualTo((int)'a'));
            Assert.That(reader.Read(), Is.EqualTo((int)'a'));
            Assert.That(reader.Peek(), Is.EqualTo((int)'b'));
            Assert.That(reader.Read(), Is.EqualTo((int)'b'));
            Assert.That(reader.Peek(), Is.EqualTo((int)'c'));
            Assert.That(reader.Read(), Is.EqualTo((int)'c'));
            Assert.That(reader.Peek(), Is.EqualTo(-1));
            Assert.That(reader.Read(), Is.EqualTo(-1));
        }
Пример #2
0
        public void StringReader_and_SpoolReader_should_return_minus_one_if_empty()
        {
            var reader1 = new StringReader("");
            var reader2 = new SpoolReader(new SpoolWriter());

            Assert.That(reader1.Peek(), Is.EqualTo(-1));
            Assert.That(reader2.Peek(), Is.EqualTo(-1));
        }