Beispiel #1
0
        public static string Solve(string rnExpression)
        {
            string normalExpression = RomanExpression.ChangeRomanExpressionToNormalExpression(rnExpression);
            string rpn           = RPN.ConvertToRPN(normalExpression);
            int    decimalResult = RPN.SolveRPN(rpn);
            string romanResult   = new RomanNumeral(decimalResult).romanNumeralStr;

            return(romanResult);
        }
        public void SolveRPN_FractionWhileSolving_ReturnRPN()
        {
            var ex = Assert.Throws <ArgumentException>(() => RPN.SolveRPN("2 1 2 / *"));

            StringAssert.Contains("This isn't roman numeral!", ex.Message);
        }
        public void SolveRPN_ValidExpression_ReturnRPN(string expression, int expected)
        {
            int result = RPN.SolveRPN(expression);

            Assert.AreEqual(expected, result);
        }