Example #1
0
        public void TestSubtraction()
        {
            var first  = InstanceRomeNumber.GetInstance("XX");
            var second = InstanceRomeNumber.GetInstance("VIII");

            Assert.AreEqual(first - second, RomeNumber.ConvertUIntToRomeNumber(12));
        }
Example #2
0
        public void TestAddition()
        {
            var first  = InstanceRomeNumber.GetInstance("X");
            var second = InstanceRomeNumber.GetInstance("V");

            Assert.AreEqual(first + second, RomeNumber.ConvertUIntToRomeNumber(15));
        }
Example #3
0
        public void TestMultiply()
        {
            var first  = InstanceRomeNumber.GetInstance("IV");
            var second = InstanceRomeNumber.GetInstance("XIV");

            Assert.AreEqual(first * second, RomeNumber.ConvertUIntToRomeNumber(56));
        }
Example #4
0
        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);
            }
        }