Example #1
0
        private RomanToArabicConverter CreateRomanToArabicConverter()
        {
            IRomanNumeralValidator romanNumeralValidator = new RomanNumeralValidator();
            IValueGatherer         valueGatherer         = new ValueGatherer();

            return(new RomanToArabicConverter(romanNumeralValidator, valueGatherer));
        }
Example #2
0
        public void CorrectlyGathersOne()
        {
            ValueGatherer valueGatherer = new ValueGatherer();

            valueGatherer.Add(RomanDigit.I);

            int result = valueGatherer.GetValue();

            Assert.AreEqual(1, result);
        }
Example #3
0
        public void CorrectlyGathersOneHundredSixty()
        {
            ValueGatherer valueGatherer = new ValueGatherer();

            valueGatherer.Add(RomanDigit.C);
            valueGatherer.Add(RomanDigit.L);
            valueGatherer.Add(RomanDigit.X);

            int result = valueGatherer.GetValue();

            Assert.AreEqual(160, result);
        }
Example #4
0
        public void CorrectlyGathersTwoThousandNineteen()
        {
            ValueGatherer valueGatherer = new ValueGatherer();

            valueGatherer.Add(RomanDigit.M);
            valueGatherer.Add(RomanDigit.M);
            valueGatherer.Add(RomanDigit.X);
            valueGatherer.Add(RomanDigit.I);
            valueGatherer.Add(RomanDigit.X);

            int result = valueGatherer.GetValue();

            Assert.AreEqual(2019, result);
        }
Example #5
0
        public void CorrectlyGathersOneThousandNineHundredNinety()
        {
            ValueGatherer valueGatherer = new ValueGatherer();

            valueGatherer.Add(RomanDigit.M);
            valueGatherer.Add(RomanDigit.C);
            valueGatherer.Add(RomanDigit.M);
            valueGatherer.Add(RomanDigit.X);
            valueGatherer.Add(RomanDigit.C);

            int result = valueGatherer.GetValue();

            Assert.AreEqual(1990, result);
        }
Example #6
0
        public void CorrectlyGathersOneThousandSixtySix()
        {
            ValueGatherer valueGatherer = new ValueGatherer();

            valueGatherer.Add(RomanDigit.M);
            valueGatherer.Add(RomanDigit.L);
            valueGatherer.Add(RomanDigit.X);
            valueGatherer.Add(RomanDigit.V);
            valueGatherer.Add(RomanDigit.I);

            int result = valueGatherer.GetValue();

            Assert.AreEqual(1066, result);
        }
Example #7
0
        public void CorrectlyGathersFourHundredTwentyOne()
        {
            ValueGatherer valueGatherer = new ValueGatherer();

            valueGatherer.Add(RomanDigit.C);
            valueGatherer.Add(RomanDigit.D);
            valueGatherer.Add(RomanDigit.X);
            valueGatherer.Add(RomanDigit.X);
            valueGatherer.Add(RomanDigit.I);

            int result = valueGatherer.GetValue();

            Assert.AreEqual(421, result);
        }
Example #8
0
        public void CorrectlyGathersTwoHundredSeven()
        {
            ValueGatherer valueGatherer = new ValueGatherer();

            valueGatherer.Add(RomanDigit.C);
            valueGatherer.Add(RomanDigit.C);
            valueGatherer.Add(RomanDigit.V);
            valueGatherer.Add(RomanDigit.I);
            valueGatherer.Add(RomanDigit.I);

            int result = valueGatherer.GetValue();

            Assert.AreEqual(207, result);
        }
Example #9
0
        public void CorrectlyGathersOneThousandNineHundredFiftyFour()
        {
            ValueGatherer valueGatherer = new ValueGatherer();

            valueGatherer.Add(RomanDigit.M);
            valueGatherer.Add(RomanDigit.C);
            valueGatherer.Add(RomanDigit.M);
            valueGatherer.Add(RomanDigit.L);
            valueGatherer.Add(RomanDigit.I);
            valueGatherer.Add(RomanDigit.V);

            int result = valueGatherer.GetValue();

            Assert.AreEqual(1954, result);
        }
Example #10
0
        public void CorrectlyGathersTwoHundredFortySix()
        {
            ValueGatherer valueGatherer = new ValueGatherer();

            valueGatherer.Add(RomanDigit.C);
            valueGatherer.Add(RomanDigit.C);
            valueGatherer.Add(RomanDigit.X);
            valueGatherer.Add(RomanDigit.L);
            valueGatherer.Add(RomanDigit.V);
            valueGatherer.Add(RomanDigit.I);

            int result = valueGatherer.GetValue();

            Assert.AreEqual(246, result);
        }