public ConvertInputStringToReversePolishSignature ( String expression ) : String | ||
expression | String | |
Résultat | String |
public string CalculateExpression(string expression) { var reversePolishSignature = _parser.ConvertInputStringToReversePolishSignature(expression); var resultInArarbicFormat = GetResultOfCalculationInArabicFormat(reversePolishSignature); if (resultInArarbicFormat <= 0) { throw new ArgumentException("Not positive result of calculation"); } var resultInRomatFormat = _parser.ConvertArabicNumberToRoman(resultInArarbicFormat); return(resultInRomatFormat); }
public void ConvertInputStringToReversePolishSignature_CorrectValue() { var parser = new ParserArithmeticExpression(); const string inputArithmeticExpression = "(VII*IX)*(IX+(LVII*I))"; //Your constant expectedReversePolishSignature scares me const string expectedReversePolishSignature = "$VII$$IX$*$IX$$LVII$$I$*+*"; var actualReversePolishSignature = parser.ConvertInputStringToReversePolishSignature(inputArithmeticExpression); Assert.AreEqual(expectedReversePolishSignature, actualReversePolishSignature); }