public void ThrowsWhenTooFewArgumentsForOperator() { var tokens = new Token[] { new Argument(-3.7), new SumOperator() }; var expression = new RpnExpression(tokens); var result = expression.CalculateResult(); }
public void ThrowsIfTooManyTokensInExpression() { var tokens = new Token[] { new Argument(4.5), new Argument(7), new SumOperator(), new Argument(-1) }; var expression = new RpnExpression(tokens); var result = expression.CalculateResult(); }
private void CheckResult(IEnumerable<Token> tokens, double expectedResult) { var expression = new RpnExpression(tokens); Assert.AreEqual(expectedResult, expression.CalculateResult()); }