public void FailedExpressionNegativeIntegerTest(string mathExpression) { var ex = Assert.Throws <ArithmeticException>(() => OperatorProcess.Evaluate(mathExpression)); Assert.Equal("Negative Integer not permitted", ex.Message); }
public void FailedExpressionDivideByZeroTest(string mathExpression) { var ex = Assert.Throws <DivideByZeroException>(() => OperatorProcess.Evaluate(mathExpression)); Assert.Equal("Attempted to divide by zero.", ex.Message); }
public void PassedExpressionTest(string mathExpression, string expectedResult) { Assert.Equal(OperatorProcess.Evaluate(mathExpression), expectedResult); }
public void FailedExpressionFormatTest(string mathExpression) { var ex = Assert.Throws <FormatException>(() => OperatorProcess.Evaluate(mathExpression)); Assert.Equal("Input string was not in a correct format.", ex.Message); }
public ActionResult <string> Post(string expression) { return(ExceptionHandling(() => OperatorProcess.Evaluate(expression))); }