Exemplo n.º 1
0
        public void Peek_should_seek_buffer()
        {
            var chars      = Autofixture.CreateMany <char>(10).ToList();
            var enumerator = chars.GetEnumerator();
            var seeker     = new BufferedSeeker(enumerator);

            // Act
            seeker.Peek();
            var result = seeker.Peek();

            // Assert
            result.Should().Be(chars.Skip(1).First());
            seeker.PeakIndex.Should().Be(2);
        }
Exemplo n.º 2
0
        public void Backtrack_peek_should_move_peek_index_backwards()
        {
            var chars      = Autofixture.CreateMany <char>(10).ToList();
            var enumerator = chars.GetEnumerator();
            var seeker     = new BufferedSeeker(enumerator);

            // Act
            seeker.Peek();
            seeker.Peek();
            seeker.BacktrackPeek(2);
            var result = seeker.Peek();

            // Assert
            result.Should().Be(chars.First());
            seeker.PeakIndex.Should().Be(1);
        }