コード例 #1
0
 public void ToArabicTest_SpecialNumbers()
 {
     foreach (var number in specialNumbers)
     {
         Assert.AreEqual(number.Value, RomanConvertor.ToArabic(number.Key));
     }
 }
コード例 #2
0
 public void ToArabicTest_RandomSuccessfulValues()
 {
     foreach (var number in sampleRandomNumbers)
     {
         Assert.AreEqual(number.Value, RomanConvertor.ToArabic(number.Key));
     }
 }
コード例 #3
0
 public void ToRomanTest_TestNegative()
 {
     Assert.ThrowsException <InvalidOperationException>(() =>
     {
         var result = RomanConvertor.ToRoman(-1);
     }
                                                        );
 }
コード例 #4
0
        public void Test_Sanity()
        {
            var originalRomanNumber = "MCDXCVIII";
            var convertedArabic     = RomanConvertor.ToArabic(originalRomanNumber);
            var convertedRoman      = RomanConvertor.ToRoman(convertedArabic);

            Assert.AreEqual(originalRomanNumber, convertedRoman);
        }
コード例 #5
0
 public void ToArabicTest_InvalidChars()
 {
     Assert.ThrowsException <FormatException>(() =>
     {
         var result = RomanConvertor.ToArabic("XXBBIIOO");
     }
                                              );
 }
コード例 #6
0
 public void ToRomanTest_TestMoreThan4000()
 {
     Assert.ThrowsException <InvalidOperationException>(() =>
     {
         var result = RomanConvertor.ToRoman(4001);
     }
                                                        );
 }
コード例 #7
0
 public void ConvertToRoman(int arabicValue, string romanValue)
 {
     Assert.AreEqual(romanValue, RomanConvertor.ToRoman(arabicValue));
 }
コード例 #8
0
 public void ToRomanTest_RepeatingSingleDigits()
 {
     Assert.AreEqual("I", RomanConvertor.ToRoman(1));
     Assert.AreEqual("III", RomanConvertor.ToRoman(3));
 }