Exemplo n.º 1
0
        public void ShouldConvertDoubleDigit()
        {
            var converter = new RomanConverter();

            Assert.AreEqual(2, converter.Convert("II"));
            Assert.AreEqual(20, converter.Convert("XX"));
        }
Exemplo n.º 2
0
        public void ShouldConvertComplexNumber()
        {
            var converter = new RomanConverter();

            Assert.AreEqual(4, converter.Convert("IV"));
            Assert.AreEqual(1946, converter.Convert("MCMXLVI"));
        }
Exemplo n.º 3
0
        public void Convert_WhenGiven0_ReturnsEmptyString(int input, string expected)
        {
            RomanConverter converter = new RomanConverter();

            string actual = converter.Convert(input);

            Assert.Equal(expected, actual);
        }
Exemplo n.º 4
0
        public void Entering_the_Roman_Numeral_I_Results_in_number_1()
        {
            var romanNumeral   = "I";
            var romanConverter = new RomanConverter();

            var result = romanConverter.Convert(romanNumeral);

            Assert.AreEqual(1, result);
        }
Exemplo n.º 5
0
        private void AssertRomanNumber(string romanNumber, int expected)
        {
            var result = RomanConverter.Convert(romanNumber);

            if (result != expected)
            {
                Assert.Fail("Le chiffre " + romanNumber + " donne " + result.ToString(CultureInfo.InvariantCulture) + ". attendu : " + expected);
            }
        }
Exemplo n.º 6
0
        public void ShouldConvertSingleDigit()
        {
            var converter = new RomanConverter();

            Assert.AreEqual(1, converter.Convert("I"));
            Assert.AreEqual(5, converter.Convert("V"));
            Assert.AreEqual(10, converter.Convert("X"));
            Assert.AreEqual(50, converter.Convert("L"));
            Assert.AreEqual(100, converter.Convert("C"));
            Assert.AreEqual(500, converter.Convert("D"));
            Assert.AreEqual(1000, converter.Convert("M"));
        }
Exemplo n.º 7
0
 static void Main(string[] args)
 {
     while (true)
     {
         Console.Write("Tapez un chiffre romain : ");
         var line = Console.ReadLine();
         try {
             Console.WriteLine("Valeur : {0}", RomanConverter.Convert(line));
         }
         catch (Exception ex) {
             Console.WriteLine(ex.Message);
         }
     }
 }
Exemplo n.º 8
0
        private static void ConvertAndAssertAreEqual(string symbol, int expected)
        {
            var result = RomanConverter.Convert(symbol);

            Assert.AreEqual(expected, result);
        }
        public void Convert4FromIV()
        {
            RomanConverter converter = new RomanConverter();

            Assert.AreEqual(4, converter.Convert("IV"));
        }
        public void Convert400ToCD()
        {
            RomanConverter converter = new RomanConverter();

            Assert.AreEqual("CD", converter.Convert(400));
        }
        public void ConvertMMMCMXCIXTo3999()
        {
            RomanConverter converter = new RomanConverter();

            Assert.AreEqual(3999, converter.Convert("MMMCMXCIX"));
        }
        public void Convert0ToNulla()
        {
            RomanConverter converter = new RomanConverter();

            Assert.AreEqual("nulla", converter.Convert(0));
        }
Exemplo n.º 13
0
        public void Can_Convert(int number, string expected)
        {
            var romanNumeral = _converter.Convert(number);

            romanNumeral.Should().Be(expected);
        }
Exemplo n.º 14
0
        private void TestConversion(string romanDigit, int expectedValue)
        {
            var result = RomanConverter.Convert(romanDigit);

            Assert.AreEqual(expectedValue, result);
        }
        public void Convert24ToIX()
        {
            RomanConverter converter = new RomanConverter();

            Assert.AreEqual("XXIV", converter.Convert(24));
        }
        public void Convert19ToIX()
        {
            RomanConverter converter = new RomanConverter();

            Assert.AreEqual("XIX", converter.Convert(19));
        }
        public void Convert26ToXXVI()
        {
            RomanConverter converter = new RomanConverter();

            Assert.AreEqual("XXVI", converter.Convert(26));
        }
        public void ConvertABCToFail()
        {
            RomanConverter converter = new RomanConverter();

            Assert.ThrowsException <Exception>(() => converter.Convert("ABC"));
        }
        public void Convert25ToXXV()
        {
            RomanConverter converter = new RomanConverter();

            Assert.AreEqual("XXV", converter.Convert(25));
        }
        public void ConvertMMMMCMXCIXToFail()
        {
            RomanConverter converter = new RomanConverter();

            Assert.ThrowsException <Exception>(() => converter.Convert("MMMMCMXCIX")); //This is not a valid roman numeral, techincally 4000 is IV
        }
        public void ConvertNeg10ToFail()
        {
            RomanConverter converter = new RomanConverter();

            Assert.ThrowsException <NotImplementedException>(() => converter.Convert(-10));
        }
Exemplo n.º 22
0
 [TestCase("M", 1000)] // nur 1 röm. Ziffer
 public void Akzeptanztests(string roman, int translation)
 {
     Assert.AreEqual(translation, RomanConverter.Convert(roman));
 }
Exemplo n.º 23
0
        public void ConvertArabicIntoRoman(int arabicNumber, string expectedRomanNumber)
        {
            var actualRomanNumber = romanConverter.Convert(arabicNumber);

            Assert.AreEqual(expectedRomanNumber, actualRomanNumber);
        }
        public void Convert81ToLXXXI()
        {
            RomanConverter converter = new RomanConverter();

            Assert.AreEqual("LXXXI", converter.Convert(81));
        }
        public void Convert0FromNulla()
        {
            RomanConverter converter = new RomanConverter();

            Assert.AreEqual(0, converter.Convert("nulla"));
        }
        public void Convert99ToXCIX()
        {
            RomanConverter converter = new RomanConverter();

            Assert.AreEqual("XCIX", converter.Convert(99));
        }
        public void Convert1Fromi()
        {
            RomanConverter converter = new RomanConverter();

            Assert.AreEqual(1, converter.Convert("i"));
        }
        public void Convert399ToCCCXCIX()
        {
            RomanConverter converter = new RomanConverter();

            Assert.AreEqual("CCCXCIX", converter.Convert(399));
        }
        public void Convert45ToXLV()
        {
            RomanConverter converter = new RomanConverter();

            Assert.AreEqual("XLV", converter.Convert(45));
        }
        public void Convert6FromVI()
        {
            RomanConverter converter = new RomanConverter();

            Assert.AreEqual(6, converter.Convert("VI"));
        }