public static GetInstance ( string Rome ) : RomeNumber | ||
Rome | string | |
Результат | RomeNumber |
public void TestAddition() { var first = InstanceRomeNumber.GetInstance("X"); var second = InstanceRomeNumber.GetInstance("V"); Assert.AreEqual(first + second, RomeNumber.ConvertUIntToRomeNumber(15)); }
public void TestSubtraction() { var first = InstanceRomeNumber.GetInstance("XX"); var second = InstanceRomeNumber.GetInstance("VIII"); Assert.AreEqual(first - second, RomeNumber.ConvertUIntToRomeNumber(12)); }
public void TestMultiply() { var first = InstanceRomeNumber.GetInstance("IV"); var second = InstanceRomeNumber.GetInstance("XIV"); Assert.AreEqual(first * second, RomeNumber.ConvertUIntToRomeNumber(56)); }
public void TestConvertUIntToRomeNumber() { var equalsDictionary = new Dictionary <RomeNumber, RomeNumber> { { InstanceRomeNumber.GetInstance("X"), RomeNumber.ConvertUIntToRomeNumber(10) }, { InstanceRomeNumber.GetInstance("XI"), RomeNumber.ConvertUIntToRomeNumber(11) }, { InstanceRomeNumber.GetInstance("CXI"), RomeNumber.ConvertUIntToRomeNumber(111) }, { InstanceRomeNumber.GetInstance("IV"), RomeNumber.ConvertUIntToRomeNumber(4) }, { InstanceRomeNumber.GetInstance("MCMXCIX"), RomeNumber.ConvertUIntToRomeNumber(1999) }, { InstanceRomeNumber.GetInstance("MMM"), RomeNumber.ConvertUIntToRomeNumber(3000) }, { InstanceRomeNumber.GetInstance("MMMCC"), RomeNumber.ConvertUIntToRomeNumber(3200) }, { InstanceRomeNumber.GetInstance("MCMLXXXVIII"), RomeNumber.ConvertUIntToRomeNumber(1988) } }; foreach (var pair in equalsDictionary) { Assert.AreEqual(pair.Key, pair.Value); } }
public void TestConvertToUint() { var equalsDictionary = new Dictionary <uint, uint> { { InstanceRomeNumber.GetInstance("XV").ArabNumber, 15 }, { InstanceRomeNumber.GetInstance("XVIII").ArabNumber, 18 }, { InstanceRomeNumber.GetInstance("XIX").ArabNumber, 19 }, { InstanceRomeNumber.GetInstance("C").ArabNumber, 100 }, { InstanceRomeNumber.GetInstance("CCC").ArabNumber, 300 }, { InstanceRomeNumber.GetInstance("CMXCIX").ArabNumber, 999 }, { InstanceRomeNumber.GetInstance("MMMMMMIX").ArabNumber, 6009 }, { InstanceRomeNumber.GetInstance("MMMMMMMMMMMMMM").ArabNumber, 14000 }, { InstanceRomeNumber.GetInstance("MCMLXXXVIII").ArabNumber, 1988 } }; foreach (var pair in equalsDictionary) { Assert.AreEqual(pair.Key, pair.Value); } }
public void TestExeptionConverToUint2() { var a = InstanceRomeNumber.GetInstance("IC"); var temp = a.ArabNumber; }
public void TestToString() { const string Rn = "XI"; Assert.AreEqual(InstanceRomeNumber.GetInstance(Rn).ToString(), Rn); }