public void CheckRRTokenStreamBehaviourWhileEmpty1()
        {
            string description = "RewriteRuleTokenStream test";
            RewriteRuleTokenStream tokenTest =
                new RewriteRuleTokenStream(CreateTreeAdaptor(), description);

            Assert.IsFalse(tokenTest.HasNext(), "tokenTest has to give back false here.");
            Assert.AreEqual(description.ToString(), tokenTest.Description,
                            "Description strings should be equal.");
            Assert.AreEqual(0, tokenTest.Size(), "The number of elements should be zero.");
            tokenTest.Reset();
            Assert.IsTrue(true, "Reset() shouldn't make any problems here.");
            Assert.AreEqual(0, tokenTest.Size(),
                            "The number of elements should be still zero.");
            tokenTest.NextNode();
        }
        public void CheckRRTokenStreamBehaviourWithElements()
        {
            RewriteRuleTokenStream tokenTest = new RewriteRuleTokenStream(CreateTreeAdaptor(),
                                                                          "RewriteRuleTokenStream test");

            IToken token1 = CreateToken(1, "test token without any real context");

            // Test Add()
            tokenTest.Add(token1);
            Assert.AreEqual(1, tokenTest.Size(), "tokenTest should have the size 1 (1).");
            Assert.IsTrue(tokenTest.HasNext(), "HasNext() should be true here (1).");

            // Test NextNode()
            CommonTree tree = (CommonTree)tokenTest.NextNode();

            Assert.AreEqual(token1, tree.Token,
                            "The returned token should be equal to the given token (1).");
            Assert.AreEqual(1, tokenTest.Size(), "tokenTest should have the size 1 (2).");
            Assert.IsFalse(tokenTest.HasNext(), "HasNext() should be false here (1).");
            tokenTest.Reset();
            Assert.AreEqual(1, tokenTest.Size(), "tokenTest should have the size 1 (3).");
            Assert.IsTrue(tokenTest.HasNext(), "HasNext() should be true here (2).");

            // Test NextToken()
            IToken returnedToken = tokenTest.NextToken();

            Assert.AreEqual(token1, returnedToken,
                            "The returned token should be equal to the given token (2).");
            Assert.AreEqual(1, tokenTest.Size(), "tokenTest should have the size 1 (4).");
            Assert.IsFalse(tokenTest.HasNext(), "HasNext() should be false here (2).");
            tokenTest.Reset();
            Assert.AreEqual(1, tokenTest.Size(), "tokenTest should have the size 1 (5).");
            Assert.IsTrue(tokenTest.HasNext(), "HasNext() should be true here (3).");

            // Test NextTree()
            returnedToken = (IToken)tokenTest.NextTree();
            Assert.AreEqual(token1, returnedToken,
                            "The returned token should be equal to the given token (3).");
            Assert.AreEqual(1, tokenTest.Size(), "tokenTest should have the size 1 (6).");
            Assert.IsFalse(tokenTest.HasNext(), "HasNext() should be false here (2).");
            tokenTest.Reset();
            Assert.AreEqual(1, tokenTest.Size(), "tokenTest should have the size 1 (7).");
            Assert.IsTrue(tokenTest.HasNext(), "HasNext() should be true here (3).");

            // Test, what happens with two elements
            IToken token2 = CreateToken(2, "test token without any real context");

            tokenTest.Add(token2);
            Assert.AreEqual(2, tokenTest.Size(), "tokenTest should have the size 2 (1).");
            Assert.IsTrue(tokenTest.HasNext(), "HasNext() should be true here (4).");
            returnedToken = tokenTest.NextToken();
            Assert.AreEqual(token1, returnedToken,
                            "The returned token should be equal to the given token (4).");
            Assert.AreEqual(2, tokenTest.Size(), "tokenTest should have the size 2 (2).");
            Assert.IsTrue(tokenTest.HasNext(), "HasNext() should be true here (5).");
            returnedToken = tokenTest.NextToken();
            Assert.AreEqual(token2, returnedToken,
                            "The returned token should be equal to the given token (5).");
            Assert.IsFalse(tokenTest.HasNext(), "HasNext() should be false here (3).");

            // Test exception
            tokenTest.NextToken();
        }