public void CalculateExpression_NotPositiveResultOfCalculation_ExceptionThrown()
        {
            var romanCalculator = new RomanCalculator();
            const string inputArithmeticExpression = "(IX-L)";
            var expectedResultOfCalculationInRomanFormat = "-41"; //Should be constant
            var actualResultOfCalculationInRomanFormat = romanCalculator.CalculateExpression(inputArithmeticExpression);

            Assert.AreEqual(expectedResultOfCalculationInRomanFormat, actualResultOfCalculationInRomanFormat);
        }
        public void CalculateExpression_CorrectValueOfCalculation2()
        {
            var romanCalculator = new RomanCalculator();
            const string inputArithmeticExpression = "(LXII*III)-(IV+(III*(XIV/VII)+III*II))";
            var actualResultOfCalculationInRomanFormat = romanCalculator.CalculateExpression(inputArithmeticExpression);
            const string expectedResultInRomanFormat = "CLXX";

            Assert.AreEqual(expectedResultInRomanFormat, actualResultOfCalculationInRomanFormat);
        }
        public void CalculateExpression_CorrectValueOfCalculation()
        {
            var romanCalculator = new RomanCalculatorLibrary.RomanCalculator(); //See Re#, RomanCalculatorLibrary is redundant
            const string inputArithmeticExpression = "(IX+(XVII*IV))-(VII*IX)";
            var actualResultOfCalculationInRomanFormat = romanCalculator.CalculateExpression(inputArithmeticExpression);
            const string expectedResultInRomanFormat = "XIV";

            Assert.AreEqual(expectedResultInRomanFormat, actualResultOfCalculationInRomanFormat);
        }
예제 #4
0
        public void CalculateExpression_CorrectValueOfCalculation()
        {
            var          romanCalculator           = new RomanCalculatorLibrary.RomanCalculator(); //See Re#, RomanCalculatorLibrary is redundant
            const string inputArithmeticExpression = "(IX+(XVII*IV))-(VII*IX)";
            var          actualResultOfCalculationInRomanFormat = romanCalculator.CalculateExpression(inputArithmeticExpression);
            const string expectedResultInRomanFormat            = "XIV";

            Assert.AreEqual(expectedResultInRomanFormat, actualResultOfCalculationInRomanFormat);
        }
        public void CalculateExpression_InpuExpressionIsProperlyCalculated()
        {
            var romanCalculator = new RomanCalculator();
            var inputArithmeticExpression = "(IX+(XVII*IV))-(VII*IX)";
            var actualResultOfCalculationInRomanFormat = romanCalculator.CalculateExpression(inputArithmeticExpression);
            var expectedResultInRomanFormat = "XIV";
            Assert.AreEqual(expectedResultInRomanFormat, actualResultOfCalculationInRomanFormat);

            inputArithmeticExpression = "(LXII*III)-(IV+(III*(XIV/VII)+III*II))";
            actualResultOfCalculationInRomanFormat = romanCalculator.CalculateExpression(inputArithmeticExpression);
            expectedResultInRomanFormat = "CLXX";
            Assert.AreEqual(expectedResultInRomanFormat, actualResultOfCalculationInRomanFormat);
        }
 public void CalculateExpression_UncorrectRomanNumber_ExceptionThrown()
 {
     var romanCalculator = new RomanCalculator();
     const string inputArithmeticExpression = "(IX+F)";
     romanCalculator.CalculateExpression(inputArithmeticExpression);
 }
 public void CalculateExpression_UncorrectArithmeticExpression_ExceptionThrown()
 {
     var romanCalculator = new RomanCalculator();
     const string inputArithmeticExpression = "(IX+(XVII**IV))-(VII*IX)";
     romanCalculator.CalculateExpression(inputArithmeticExpression);
 }
 public void CalculateExpression_UncorrectArithmeticExpressionWithTerminalSign_ExceptionThrown()
 {
     var romanCalculator = new RomanCalculator();
     const string inputArithmeticExpression = "(V$2)";
     romanCalculator.CalculateExpression(inputArithmeticExpression);
 }
 public void CalculateExpression_ResultOfDivisionIsNotInteger_ExceptionThrown()
 {
     var romanCalculator = new RomanCalculator();
     const string inputArithmeticExpression = "(IX/IV)";
     romanCalculator.CalculateExpression(inputArithmeticExpression);
 }
예제 #10
0
 public void CalculateExpression_NotPositiveResultOfCalculation_ExceptionThrown()
 {
     var romanCalculator = new RomanCalculator();
     const string inputArithmeticExpression = "(IX-L)";
     romanCalculator.CalculateExpression(inputArithmeticExpression);
 }
예제 #11
0
        public void CalculateExpression_UncorrectArithmeticExpression_ExceptionThrown()
        {
            var romanCalculator = new RomanCalculator();
            const string inputArithmeticExpression = "(IX+(XVII**IV))-(VII*IX)";
            var actualResultOfCalculationInRomanFormat = romanCalculator.CalculateExpression(inputArithmeticExpression);
            const string expectedResultInRomanFormat = "XIV";

            Assert.AreEqual(expectedResultInRomanFormat, actualResultOfCalculationInRomanFormat);
        }
예제 #12
0
 public void CalculateExpression_UncorrectAmountOfBrackets_ExceptionThrown()
 {
     var romanCalculator = new RomanCalculator();
     const string inputArithmeticExpression = "(IX+(XVII*IV))-(VII*IX)(((";
     var actualResultOfCalculationInRomanFormat = romanCalculator.CalculateExpression(inputArithmeticExpression);
 }
예제 #13
0
 public void CalculateExpression_UncorrectRomanNumber_ExceptionThrown()
 {
     var romanCalculator = new RomanCalculator();
     const string inputArithmeticExpression = "(IX+F)";
     var actualResultOfCalculationInRomanFormat = romanCalculator.CalculateExpression(inputArithmeticExpression);
 }
예제 #14
0
 public void CalculateExpression_UncorrectArithmeticExpression_ExceptionThrown2()
 {
     var romanCalculator = new RomanCalculator();
     const string inputArithmeticExpression = "(V++2)";
     //Why do we need this variable (it seems that I write this kind of comments again and again, may be it is just your style)
     var actualResultOfCalculationInRomanFormat = romanCalculator.CalculateExpression(inputArithmeticExpression);
 }