Exemplo n.º 1
0
    public string Sum(string a, string b, bool romanOutpout)
    {
        int aNumber;
        int bNumber;

        if (!int.TryParse(a, out aNumber))
        {
            aNumber = parser.RomanToArabic(a);
        }

        if (!int.TryParse(b, out bNumber))
        {
            bNumber = parser.RomanToArabic(b);
        }

        int result = Sum(aNumber, bNumber);

        switch (romanOutpout)
        {
        case true:
            if (result > 0 && result < 4000)
            {
                return(parser.ArabicToRoman(result));
            }
            else
            {
                return(result.ToString());
            }

        default:
            return(result.ToString());
        }
    }
    public void ParsesArabicNumber(int input, string result)
    {
        string outpout = parser.ArabicToRoman(input);

        Assert.AreEqual(result, outpout);
    }