public void SingleCharTokenTest()
        {
            ParsingContextTestImpl context = new ParsingContextTestImpl();
            MatchTokenParsingState target  = new MatchTokenParsingState(",");

            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, 'a'), ParsingResult.Miss);
            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, 'c'), ParsingResult.Miss);
            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, ','), ParsingResult.Done);
            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, 'x'), ParsingResult.Miss);
            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, ','), ParsingResult.Done);
        }
        public void MultiCharTokenWithNextAndErrorTest()
        {
            ParsingContextTestImpl context    = new ParsingContextTestImpl();
            ParsingStateTestImpl   nextState  = new ParsingStateTestImpl(ParsingResult.Match);
            ParsingStateTestImpl   errorState = new ParsingStateTestImpl(ParsingResult.Match);

            MatchTokenParsingState target = new MatchTokenParsingState(":=>");

            target.AddNextState(nextState);
            target.SetErrorState(errorState);

            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, 'f'), ParsingResult.Miss);
            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, 't'), ParsingResult.Miss);
            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, ':'), ParsingResult.Match);
            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, 'x'), ParsingResult.Miss);
            Assert.AreEqual <IParsingState>(errorState, context.CurrentState);
            Assert.AreEqual <string>(":", context.CurrentText);
            context.ResetText();
            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, ':'), ParsingResult.Match);
            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, '='), ParsingResult.Match);
            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, '>'), ParsingResult.Match);
            Assert.AreEqual <IParsingState>(nextState, context.CurrentState);
            Assert.AreEqual <string>(string.Empty, context.CurrentText);
            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, 'y'), ParsingResult.Miss);
            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, 'm'), ParsingResult.Miss);
            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, ':'), ParsingResult.Match);
            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, '='), ParsingResult.Match);
            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, '>'), ParsingResult.Match);
            Assert.AreEqual <IParsingState>(nextState, context.CurrentState);
            Assert.AreEqual <string>(string.Empty, context.CurrentText);
        }
        public void NullParsingContextTest()
        {
            MatchTokenParsingState target = new MatchTokenParsingState(",");

            target.ProcessCharacter(null, 'a');
        }
        public void MultiCharTokenWithNextTest()
        {
            ParsingContextTestImpl context   = new ParsingContextTestImpl();
            ParsingStateTestImpl   nextState = new ParsingStateTestImpl(ParsingResult.Match);
            MatchTokenParsingState target    = new MatchTokenParsingState(",;:!");

            target.AddNextState(nextState);

            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, 'a'), ParsingResult.Miss);
            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, 'c'), ParsingResult.Miss);
            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, ','), ParsingResult.Match);
            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, 'x'), ParsingResult.Miss);
            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, ','), ParsingResult.Match);
            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, ';'), ParsingResult.Match);
            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, ':'), ParsingResult.Match);
            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, '!'), ParsingResult.Match);
            Assert.AreEqual <IParsingState>(nextState, context.CurrentState);
            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, 'y'), ParsingResult.Miss);
            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, ','), ParsingResult.Match);
            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, ';'), ParsingResult.Match);
            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, ':'), ParsingResult.Match);
            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, 'z'), ParsingResult.Miss);
            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, ','), ParsingResult.Match);
            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, ';'), ParsingResult.Match);
            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, ':'), ParsingResult.Match);
            Assert.AreEqual <ParsingResult>(target.ProcessCharacter(context, '!'), ParsingResult.Match);
            Assert.AreEqual <IParsingState>(nextState, context.CurrentState);
        }