Esempio n. 1
0
        public void HasNextTest()
        {
            //Create list and add dummy tokens to it
            List<Token> tokenStream = new List<Token>();
            Token token1 = new Token();
            Token token2 = new Token();
            tokenStream.Add(token1);
            tokenStream.Add(token2);

            //Create iterator with tokenstream and then test some things out
            TokenIterator iterator = new TokenIterator(tokenStream);

            //Check size
            Assert.IsTrue(iterator.GetSize() == tokenStream.Count);

            //Check if tokens are in list
            Assert.IsTrue(iterator.HasNext());

            //Check also if there are 2 items in list
            Assert.IsTrue(iterator.HasNext(2));

            //Get first token and check

            Token CurrentToken = iterator.NextToken();
            Assert.AreEqual(token1, CurrentToken);

            //Get second token and check
            Assert.IsTrue(iterator.HasNext());
            CurrentToken = iterator.NextToken();
            Assert.AreEqual(token2, CurrentToken);

            //No items in list left
            Assert.IsFalse(iterator.HasNext());
        }
Esempio n. 2
0
 public void NextTokenTest()
 {
     List<Token> tokenStream = null; // TODO: Initialize to an appropriate value
     TokenIterator target = new TokenIterator(tokenStream); // TODO: Initialize to an appropriate value
     Token expected = null; // TODO: Initialize to an appropriate value
     Token actual;
     actual = target.NextToken();
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }