public void CorrectValue(string input, double value) { StringExpression parser = new StringExpression(input, new TokenFactory()); var parsed = parser.Parse(); var evaluator = new ParsedExpression(parsed); Assert.Equal(value, evaluator.Evaluate()); }
public void DivisionByZero(string input) { StringExpression parser = new StringExpression(input, new TokenFactory()); var parsed = parser.Parse(); var evaluator = new ParsedExpression(parsed); Assert.Throws <ArithmeticException>(() => evaluator.Evaluate()); }
public void InvalidSyntax(string input) { StringExpression parser = new StringExpression(input, new TokenFactory()); Assert.Throws <ArgumentException>(() => parser.Parse()); }