public void GetResultThrowsInvalidCastExceptionWhenApplyIsNotCalled(CruncherAutomator automator)
        {
            // -- Arrange

            // -- Act
            var automator2 = automator.Process(new ParserResult("MULTIPLY", 4))
                .Process(new ParserResult("SUBTRACT", 5))
                .Process(new ParserResult("DIVIDE", 2))
                .Process(new ParserResult("ADD", 8));

            // -- Assert
            Assert.ThrowsAny<InvalidCastException>(() => automator2.GetResult());
        }
        public void GetResultThrowsInvalidCastExceptionWhenApplyIsNotCalled(CruncherAutomator automator)
        {
            // -- Arrange

            // -- Act
            var automator2 = automator.Process(new ParserResult("MULTIPLY", 4))
                             .Process(new ParserResult("SUBTRACT", 5))
                             .Process(new ParserResult("DIVIDE", 2))
                             .Process(new ParserResult("ADD", 8));


            // -- Assert
            Assert.ThrowsAny <InvalidCastException>(() => automator2.GetResult());
        }
        public void CalculatesASimpleEquation(
            int applyValue,
            int multiplyValue,
            int subtractValue,
            int divideValue,
            int addValue,
            decimal expected,
            CruncherAutomator automator)
        {
            // -- Arrange

            // -- Act
            var actual = automator.Process(new ParserResult("MULTIPLY", multiplyValue))
                .Process(new ParserResult("SUBTRACT", subtractValue))
                .Process(new ParserResult("DIVIDE", divideValue))
                .Process(new ParserResult("ADD", addValue))
                .Process(new ParserResult("APPLY", applyValue))
                .GetResult();

            // -- Assert
            Assert.Equal(expected, actual);
        }
        public void CalculatesASimpleEquation(
            int applyValue,
            int multiplyValue,
            int subtractValue,
            int divideValue,
            int addValue,
            decimal expected,
            CruncherAutomator automator)
        {
            // -- Arrange

            // -- Act
            var actual = automator.Process(new ParserResult("MULTIPLY", multiplyValue))
                         .Process(new ParserResult("SUBTRACT", subtractValue))
                         .Process(new ParserResult("DIVIDE", divideValue))
                         .Process(new ParserResult("ADD", addValue))
                         .Process(new ParserResult("APPLY", applyValue))
                         .GetResult();

            // -- Assert
            Assert.Equal(expected, actual);
        }