public void NumberSmallerOrEqualZeroOrGreaterThan1000AreNotConverted() { var convertor = new RomanNumeralsConverter(); Assert.AreEqual(convertor.ToRoman(-1), "NaN"); Assert.AreEqual(convertor.ToRoman(0), "NaN"); Assert.AreEqual(convertor.ToRoman(1001), "NaN"); }
public void OtherNumbersAreConvertedToRoman() { var convertor = new RomanNumeralsConverter(); Assert.AreEqual(convertor.ToRoman(2), "II"); Assert.AreEqual(convertor.ToRoman(3), "III"); Assert.AreEqual(convertor.ToRoman(37), "XXXVII"); Assert.AreEqual(convertor.ToRoman(47), "XLVII"); Assert.AreEqual(convertor.ToRoman(300), "CCC"); Assert.AreEqual(convertor.ToRoman(501), "DI"); Assert.AreEqual(convertor.ToRoman(990), "CMXC"); }
public void Convert_Number_To_Roman_Number_Literal(int input, string expected) { // Given var converter = new RomanNumeralsConverter(); // When var actual = converter.Convert(input); // Then Assert.Equal(expected, actual); }
public void ConvertRomanToArabic() { var convertor = new RomanNumeralsConverter(); Assert.AreEqual(1, convertor.ToArabic("I")); Assert.AreEqual(1000, convertor.ToArabic("M")); Assert.AreEqual(50, convertor.ToArabic("L")); Assert.AreEqual(9, convertor.ToArabic("IX")); Assert.AreEqual(990, convertor.ToArabic("CMXC")); Assert.AreEqual(501, convertor.ToArabic("DI")); Assert.AreEqual(37, convertor.ToArabic("XXXVII")); Assert.AreEqual(47, convertor.ToArabic("XLVII")); }
static void Main(string[] args) { int result = 0; bool success = Int32.TryParse(Console.ReadLine(), out result); while (!success) { success = Int32.TryParse(Console.ReadLine(), out result); } string romanNumeral = new RomanNumeralsConverter().Convert(result); Console.WriteLine(romanNumeral); Console.ReadLine(); }
public void BaseNumbersAreConvertedToRoman() { var convertor = new RomanNumeralsConverter(); Assert.AreEqual(convertor.ToRoman(1), "I"); Assert.AreEqual(convertor.ToRoman(4), "IV"); Assert.AreEqual(convertor.ToRoman(5), "V"); Assert.AreEqual(convertor.ToRoman(9), "IX"); Assert.AreEqual(convertor.ToRoman(10), "X"); Assert.AreEqual(convertor.ToRoman(40), "XL"); Assert.AreEqual(convertor.ToRoman(50), "L"); Assert.AreEqual(convertor.ToRoman(90), "XC"); Assert.AreEqual(convertor.ToRoman(100), "C"); Assert.AreEqual(convertor.ToRoman(400), "CD"); Assert.AreEqual(convertor.ToRoman(500), "D"); Assert.AreEqual(convertor.ToRoman(900), "CM"); Assert.AreEqual(convertor.ToRoman(1000), "M"); }
private static void NumberToRomanNumeralShouldBe(int number, string expected) { Assert.AreEqual(expected, RomanNumeralsConverter.ToRoman(number)); }
public void Should_Convert_Number_to_Roman(int number, string expected) { var romNum = new RomanNumeralsConverter(); var result = romNum.NumberToRoman(number); Assert.AreEqual(expected, result); }
public void Number_greater_than_3999_should_thow_exception() { var romNum = new RomanNumeralsConverter(); romNum.NumberToRoman(4000); }