public void WhenBooleanQuestionUsedInAConditional_ParsesCorrectly( string validText, IEnumerable <string> expectedDefinitions, IEnumerable <bool> expectedLiterals, IEnumerable <string> expectedVariables, BooleanOperatorCount operatorCount, IEnumerable <string> expectedSubDefinitions) { CreateForm(validText); ValidateConditionalDefinitions(expectedDefinitions); ValidateVariableNames(expectedVariables); ValidateBooleanLiterals(expectedLiterals); ValidateBooleanOperators(operatorCount); }
private void ValidateBooleanOperators(BooleanOperatorCount operatorCount) { Assert.AreEqual( expected: operatorCount.OrCount, actual: NodeCount <IOrNode>(), message: "there is an incorrect number of created '||' Nodes"); Assert.AreEqual( expected: operatorCount.AndCount, actual: NodeCount <IAndNode>(), message: "there is an incorrect number of created '&&' Nodes"); Assert.AreEqual( expected: operatorCount.EqualityCount, actual: NodeCount <IEqualityNode>(), message: "there is an incorrect number of created '==' Nodes"); Assert.AreEqual( expected: operatorCount.InequalityCount, actual: NodeCount <IInequalityNode>(), message: "there is an incorrect number of created '!=' Nodes"); Assert.AreEqual( expected: operatorCount.GreaterThanCount, actual: NodeCount <IGreaterThanNode>(), message: "there is an incorrect number of created '>' Nodes"); Assert.AreEqual( expected: operatorCount.GreaterOrEqualCount, actual: NodeCount <IGreaterOrEqualNode>(), message: "there is an incorrect number of created '>=' Nodes"); Assert.AreEqual( expected: operatorCount.LessThanCount, actual: NodeCount <ILessThanNode>(), message: "there is an incorrect number of created '<' Nodes"); Assert.AreEqual( expected: operatorCount.LessOrEqualCount, actual: NodeCount <ILessOrEqualNode>(), message: "there is an incorrect number of created '<=' Nodes"); }
private static TestCaseData BooleanTestCaseData( string formText, IEnumerable <string> definitions = null, IEnumerable <bool> values = null, IEnumerable <string> variables = null, BooleanOperatorCount operators = new BooleanOperatorCount(), IEnumerable <string> subdefinitions = null) { definitions = definitions ?? new List <string>(); values = values ?? new List <bool>(); variables = variables ?? new List <string>(); subdefinitions = subdefinitions ?? new List <string>(); return(new TestCaseData( formText, definitions, values, variables, operators, subdefinitions)); }