Exemplo n.º 1
0
        public void NextCantMove_When_LastCharacterIsReached()
        {
            ParseStream stream = new ParseStream("/t");

            stream.Next();
            stream.Next();
            stream.Next();

            Assert.AreEqual(stream.Index.Index, 1);
        }
Exemplo n.º 2
0
        public void HasMoreShouldBeFalse_WhenIndex_IsAtTheLastCharacter()
        {
            ParseStream stream = new ParseStream("/text");

            stream.Next();
            stream.Next();
            stream.Next();
            stream.Next();

            Console.WriteLine(stream.Text.Length + "=" + stream.Index.Index);
            Assert.AreEqual(stream.Current, 't');
            Assert.False(stream.HasMore);
        }
Exemplo n.º 3
0
        public void HasMoreShouldBeTrue_WhenIndex_IsLowerThanLength()
        {
            ParseStream stream = new ParseStream("/text");

            stream.Next();
            Assert.True(stream.HasMore);
        }
Exemplo n.º 4
0
        public void ShouldThrow_WhenCurrentCharIsIncorrect()
        {
            //Move cursor on char 't' after the /.
            stream.Next();
            TagParser parser = new TagParser(stream);

            Assert.Catch <InvalidOperationException>(() => parser.Parse());
        }
Exemplo n.º 5
0
        public void CurrentCharShouldTheCharOfTheIndex()
        {
            ParseStream stream = new ParseStream("/text");

            stream.Next();

            Assert.AreEqual(stream.Current, 't');
        }
Exemplo n.º 6
0
        public void NextShouldIncrementIndex()
        {
            ParseStream stream = new ParseStream("/text");

            stream.Next();

            Assert.AreEqual(stream.Index.Index, 1);
        }