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

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

            valueGatherer.Add(RomanDigit.I);

            int result = valueGatherer.GetValue();

            Assert.AreEqual(1, result);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }