コード例 #1
0
        public void ThrowsWhenTooFewArgumentsForOperator()
        {
            var tokens = new Token[]
            {
                new Argument(-3.7),
                new SumOperator()
            };

            var expression = new RpnExpression(tokens);
            var result = expression.CalculateResult();
        }
コード例 #2
0
        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();
        }
コード例 #3
0
 private void CheckResult(IEnumerable<Token> tokens, double expectedResult)
 {
     var expression = new RpnExpression(tokens);
     Assert.AreEqual(expectedResult, expression.CalculateResult());
 }