Example #1
0
        public void ConvertToRoman_Negative_Input_Throws_ArgumentOutOfRangeException()
        {
            // Arrange
            int negativeInput = -1;

            // Act & Assert
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => Roman.ConvertToRoman(negativeInput));
        }
Example #2
0
 static void Main(string[] args)
 {
     while (true)
     {
         try
         {
             Console.WriteLine("Please enter a valid integer in the range of 1 - 3999");
             Console.WriteLine(Roman.ConvertToRoman(int.Parse(Console.ReadLine())));
         }
         catch
         {
             Console.WriteLine("Invalid input, please try again");
         }
     }
 }
Example #3
0
 public void ConvertToRoman_500_D()
 {
     // Act & Assert
     Assert.AreEqual("D ", Roman.ConvertToRoman(500));
 }
Example #4
0
 public void ConvertToRoman_9_IX()
 {
     // Act & Assert
     Assert.AreEqual("IX ", Roman.ConvertToRoman(9));
 }
Example #5
0
 public void ConverToRoman_100_C()
 {
     // Act & Assert
     Assert.AreEqual("C ", Roman.ConvertToRoman(100));
 }
Example #6
0
 public void ConverToRoman_400_CD()
 {
     // Act & Assert
     Assert.AreEqual("CD ", Roman.ConvertToRoman(400));
 }
Example #7
0
 public void ConvertToRoman_50_L()
 {
     // Act & Assert
     Assert.AreEqual("L ", Roman.ConvertToRoman(50));
 }
Example #8
0
 public void ConvertToRoman_90_XC()
 {
     // Act & Assert
     Assert.AreEqual("XC ", Roman.ConvertToRoman(90));
 }
Example #9
0
 public void ConvertToRoman_10_X()
 {
     // Act & Assert
     Assert.AreEqual("X ", Roman.ConvertToRoman(10));
 }
Example #10
0
 public void ConvertToRoman_40_XL()
 {
     // Act & Assert
     Assert.AreEqual("XL ", Roman.ConvertToRoman(40));
 }
Example #11
0
 public void ConvertToRoman_5_V()
 {
     // Act & Assert
     Assert.AreEqual("V ", Roman.ConvertToRoman(5));
 }
Example #12
0
 public void ConvertToRoman_900_CM()
 {
     // Act & Assert
     Assert.AreEqual("CM ", Roman.ConvertToRoman(900));
 }
Example #13
0
 public void ConvertToRoman_4_IV()
 {
     // Act & Assert
     Assert.AreEqual("IV ", Roman.ConvertToRoman(4));
 }
Example #14
0
 public void ConvertToRoman_1_I()
 {
     // Act & Assert
     Assert.AreEqual("I ", Roman.ConvertToRoman(1));
 }
Example #15
0
 public void ConverToRoman_0_EmptyString()
 {
     // Act & Assert
     Assert.AreEqual(string.Empty, Roman.ConvertToRoman(0));
 }
Example #16
0
 public void ConvertToRoman_3999_MMMCMXCIX()
 {
     // Act & Assert
     Assert.AreEqual("M M M CM XC IX ", Roman.ConvertToRoman(3999));
 }
Example #17
0
 public void ConvertToRoman_444_CDXLIV()
 {
     // Act & Assert
     Assert.AreEqual("CD XL IV ", Roman.ConvertToRoman(444));
 }