public void ToArabic_return_8_when_VIII() { var target = new NumeralConverter(); var actual = target.ToArabic("VIII"); Assert.AreEqual(8, actual); }
public void ToArabic_return_9_when_IX() { var target = new NumeralConverter(); var actual = target.ToArabic("IX"); Assert.AreEqual(9, actual); }
public void ToArabic_return_3888_when_MMMDCCCLXXXVIII() { var target = new NumeralConverter(); var actual = target.ToArabic("MMMDCCCLXXXVIII"); Assert.AreEqual(3888, actual); }
public void ToArabic_return_2016_when_MMXVI() { var target = new NumeralConverter(); var actual = target.ToArabic("MMXVI"); Assert.AreEqual(2016, actual); }
public void ToArabic_return_50_when_L() { var target = new NumeralConverter(); var actual = target.ToArabic("L"); Assert.AreEqual(50, actual); }
public void ToArabic_returns_0_when_empty_string() { var target = new NumeralConverter(); var actual = target.ToArabic(""); Assert.AreEqual(0, actual); }
public static string Add(string addend1, string addend2) { var numericAddend1 = NumeralConverter.ToArabic(addend1); var numericAddend2 = NumeralConverter.ToArabic(addend2); var sum = numericAddend1 + numericAddend2; return(ArabicConverter.ToNumeral(sum)); }
public void ConvertToArabic_CaseIsIgnored() { const string numeral = "xxV"; var expected = 25; var result = NumeralConverter.ToArabic(numeral); result.Should().Be(expected); }
public void ConvertToArabic_WhenPassedSubtractiveNumeral_ReturnsCorrectIntegerValue() { const string numeral = "IV"; var expected = 4; var result = NumeralConverter.ToArabic(numeral); result.Should().Be(expected); }
public void ConvertToArabic_WhenPassedIIReturns2() { const string numeral = "II"; var expected = 2; var result = NumeralConverter.ToArabic(numeral); result.Should().Be(expected); }
public void ConvertToArabic_WhenPassedNumeralWithIllegalCharacterRepetitions_Throws() { const string numeral1 = "IIII"; const string numeral2 = "DD"; const string numeral3 = "VIIII"; Assert.Throws <ArgumentException>(() => NumeralConverter.ToArabic(numeral1)); Assert.Throws <ArgumentException>(() => NumeralConverter.ToArabic(numeral2)); Assert.Throws <ArgumentException>(() => NumeralConverter.ToArabic(numeral3)); }
public void ConvertToArabic_WhenPassedNumeralWithIllegalCharacters_Throws() { const string badNumeral = "WAT"; Assert.Throws <ArgumentException>(() => NumeralConverter.ToArabic(badNumeral)); }
public void ToArabic_throws_exception_when_InvalidFormat() { var target = new NumeralConverter(); target.ToArabic("IIX"); }
public void ToArabic_throws_exception_when_InvalidCharater() { var target = new NumeralConverter(); target.ToArabic("S"); }