Пример #1
0
 public void TestRoman_CanRepeat()
 {
     Assert.AreEqual(2, Roman.Parse("II"));
     Assert.AreEqual(300, Roman.Parse("CCC"));
     Assert.AreEqual(39, Roman.Parse("XXXIX"));
     Assert.AreEqual(2000, Roman.Parse("MM"));
 }
Пример #2
0
        public void TestRoman_NotDefined()
        {
            const string line = "pish tegj glob glob";
            Dictionary <string, RomanPrimitive> romanMapping = new Dictionary <string, RomanPrimitive>
            {
                { "pish", RomanPrimitive.Parse('X') },
                { "tegj", RomanPrimitive.Parse('L') }
            };

            Roman.Parse(line, romanMapping);
        }
Пример #3
0
        public void TestRoman()
        {
            const string line = "pish tegj glob glob";
            Dictionary <string, RomanPrimitive> romanMapping = new Dictionary <string, RomanPrimitive>
            {
                { "glob", RomanPrimitive.Parse('I') },
                { "pish", RomanPrimitive.Parse('X') },
                { "tegj", RomanPrimitive.Parse('L') }
            };

            Assert.AreEqual(42, Roman.Parse(line, romanMapping));
        }
Пример #4
0
 public void Parse(int expected, string roman)
 {
     Assert.AreEqual(expected, Roman.Parse(roman));
 }
Пример #5
0
 public void TestRoman_CannotSubtract()
 {
     Roman.Parse("VX");
 }
Пример #6
0
 public void TestRoman_CanSubtract()
 {
     Assert.AreEqual(444, Roman.Parse("CDXLIV"));
     Assert.AreEqual(999, Roman.Parse("CMXCIX"));
 }
Пример #7
0
 public void TestRoman_CannotRepeat()
 {
     Roman.Parse("VV");
 }
Пример #8
0
 public void TestRoman_ExceedMaxRepeatCount()
 {
     Roman.Parse("IIII");
 }
Пример #9
0
 public void TestRoman_OnePrimitive()
 {
     Assert.AreEqual(10, Roman.Parse("X"));
 }
Пример #10
0
 public void TestRoman_InvalidSubtractFrom()
 {
     Roman.Parse("IL");
 }