Beispiel #1
0
        public void ReaderCallIsStarting_True()
        {
            var buffer = new PeekBuffer <char>("abc".GetEnumerator());

            List <ITokenReader> tokenReaders = new List <ITokenReader>();
            var testReader = new TestReader();

            testReader.IsStarting = true;
            tokenReaders.Add(testReader);
            var tokenizer = new Tokenizer(buffer, tokenReaders);

            tokenizer.MoveNext();

            Assert.AreEqual(0, testReader.IsStartingCalled);
            Assert.AreEqual(1, testReader.CheckTokenCalled);
        }
Beispiel #2
0
        public void ReaderCallSequential()
        {
            var buffer = new PeekBuffer <char>("abc".GetEnumerator());

            List <ITokenReader> tokenReaders = new List <ITokenReader>();
            var testReader1 = new TestReader();
            var testReader2 = new TestReader();
            var testReader3 = new TestReader();

            tokenReaders.Add(testReader1);
            tokenReaders.Add(testReader2);
            tokenReaders.Add(testReader3);

            var tokenizer = new Tokenizer(buffer, tokenReaders);

            tokenizer.MoveNext();

            Assert.IsTrue(testReader1.IsStartingCalled < testReader2.IsStartingCalled);
            Assert.IsTrue(testReader2.IsStartingCalled < testReader3.IsStartingCalled);
        }