public void AddNextStateNullTest() { ParsingState target = new ParsingState(); target.SetErrorState(null); target.AddNextState(null); }
private static void TestLinkedStates(ParsingResult [] returnResults, int transitionIndex) { ParsingState target = new ParsingState(); ParsingResult finalResult = ParsingResult.Match; IParsingState expectedState = target; for (int i = 0; i < returnResults.Length; i++) { ParsingResult result = returnResults[i]; ParsingStateTestImpl nextState = new ParsingStateTestImpl(result); target.AddNextState(nextState); if (i == transitionIndex) { finalResult = result; if (finalResult != ParsingResult.Miss) { expectedState = nextState; } else { expectedState = target; } } } ParsingContextTestImpl context = new ParsingContextTestImpl(); context.CurrentState = target; char randomChar = (char)(new Random().Next(char.MinValue, char.MaxValue)); Assert.AreEqual(target.ProcessCharacter(context, randomChar), finalResult); Assert.AreEqual <IParsingState>(expectedState, context.CurrentState); }