public void CalculatorShouldGiveCorrectAnswer(IStack stack, string data, double result) => Assert.IsTrue(Math.Abs(StackCalculator.CalculatePostfixForm(data, stack) - result) < double.Epsilon);
public void InvalidSymbolInPostfixFormShouldThrowException(IStack stack) { var postfixForm = "5 5 XD"; Assert.Throws <System.ArgumentException>(() => StackCalculator.CalculatePostfixForm(postfixForm, stack)); }
public void UncorrectPostfixFormShouldThrowException(IStack stack) { var postfixForm = "10 10 10 +"; Assert.Throws <System.ArgumentException>(() => StackCalculator.CalculatePostfixForm(postfixForm, stack)); }
public void DivisionByZeroShouldThrowException(IStack stack) { var postfixForm = "20 0 /"; Assert.Throws <System.DivideByZeroException>(() => StackCalculator.CalculatePostfixForm(postfixForm, stack)); }