public void AddTwoRomanNumeralsTogetherCorrectly(string numeral1, string numeral2, string expectedResult)
        {
            var calculator = new RomanNumeralCalculator(
                new ConvertToSingles(),
                new ConvertToRomanNumerals());

            var result = calculator.Add(numeral1, numeral2);

            Assert.That(result, Is.EqualTo(expectedResult));
        }
Beispiel #2
0
        public TheRomanNumeralCalculator()
        {
            BeforeEach(() =>
            {
                _calculator = new RomanNumeralCalculator();
            });

            ExpectAddingResult("II", "I", "I");
            ExpectAddingResult("III", "I", "II");
            ExpectAddingResult("IV", "I", "III");
        }
Beispiel #3
0
        public void CalculatorParsesSecondArgument(string n1, string n2)
        {
            var mockParser = new Mock <IParseRomanNumerals>();
            var mockAdder  = new Mock <IAddNumbers>();

            mockParser.Setup(p => p.Parse(n2));
            var rnc = new RomanNumeralCalculator(mockParser.Object, mockAdder.Object);

            rnc.Add(n1, n2);
            mockParser.Verify();
        }
Beispiel #4
0
        public void CalculatorAddsArguments()
        {
            var mockParser = new Mock <IParseRomanNumerals>();
            var mockAdder  = new Mock <IAddNumbers>();

            mockParser.Setup(p => p.Parse(It.IsAny <string>())).Returns(1);
            mockAdder.Setup(a => a.Add(1, 1)).Verifiable();
            var rnc = new RomanNumeralCalculator(mockParser.Object, mockAdder.Object);

            rnc.Add("", "");
            mockParser.Verify();
        }
        public void GivenInteger999_WhenConvertedToRomanNumeral_AssertThatItsCMXCIX()
        {
            string romanNumeral = RomanNumeralCalculator.CalculateRomanNumeral(999);

            Assert.AreEqual(romanNumeral, "CMXCIX");
        }
        public void GivenInteger1_WhenConvertedToRomanNumeral_AssertThatItsI()
        {
            string romanNumeral = RomanNumeralCalculator.CalculateRomanNumeral(1);

            Assert.AreEqual(romanNumeral, "I");
        }
        public void GivenInteger90_WhenConvertedToRomanNumeral_AssertThatItsXC()
        {
            string romanNumeral = RomanNumeralCalculator.CalculateRomanNumeral(90);

            Assert.AreEqual(romanNumeral, "XC");
        }
        public void GivenInteger723_WhenConvertedToRomanNumeral_AssertThatItsDCCXXIII()
        {
            string romanNumeral = RomanNumeralCalculator.CalculateRomanNumeral(723);

            Assert.AreEqual(romanNumeral, "DCCXXIII");
        }
        public void GivenInteger400_WhenConvertedToRomanNumeral_AssertThatItsCD()
        {
            string romanNumeral = RomanNumeralCalculator.CalculateRomanNumeral(400);

            Assert.AreEqual(romanNumeral, "CD");
        }
        public void ConvertArabicNumberIntoRomanNumeral(int number, string expectedRomanNumeral)
        {
            var actualRomanNumeral = RomanNumeralCalculator.Convert(number);

            Assert.That(actualRomanNumeral, Is.EqualTo(expectedRomanNumeral));
        }
 public RomanNumeralFeatureContext(Dill dill) : base(dill, "roman_numeral.feature")
 {
     _calculator = new RomanNumeralCalculator();
 }