Exemplo n.º 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);
        }
Exemplo n.º 2
0
        public void SolveRPN_FractionWhileSolving_ReturnRPN()
        {
            var ex = Assert.Throws <ArgumentException>(() => RPN.SolveRPN("2 1 2 / *"));

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

            Assert.AreEqual(expected, result);
        }