GetInstance() 공개 정적인 메소드

public static GetInstance ( string Rome ) : RomeNumber
Rome string
리턴 RomeNumber
예제 #1
0
        public void TestAddition()
        {
            var first  = InstanceRomeNumber.GetInstance("X");
            var second = InstanceRomeNumber.GetInstance("V");

            Assert.AreEqual(first + second, RomeNumber.ConvertUIntToRomeNumber(15));
        }
예제 #2
0
        public void TestSubtraction()
        {
            var first  = InstanceRomeNumber.GetInstance("XX");
            var second = InstanceRomeNumber.GetInstance("VIII");

            Assert.AreEqual(first - second, RomeNumber.ConvertUIntToRomeNumber(12));
        }
예제 #3
0
        public void TestMultiply()
        {
            var first  = InstanceRomeNumber.GetInstance("IV");
            var second = InstanceRomeNumber.GetInstance("XIV");

            Assert.AreEqual(first * second, RomeNumber.ConvertUIntToRomeNumber(56));
        }
예제 #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);
            }
        }
예제 #5
0
        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);
            }
        }
예제 #6
0
 public void TestExeptionConverToUint2()
 {
     var a    = InstanceRomeNumber.GetInstance("IC");
     var temp = a.ArabNumber;
 }
예제 #7
0
        public void TestToString()
        {
            const string Rn = "XI";

            Assert.AreEqual(InstanceRomeNumber.GetInstance(Rn).ToString(), Rn);
        }