コード例 #1
0
        public void It_should_add_numbers()
        {
            var calculator = new CalculatorInternal();

            calculator.Add(2);
            calculator.Add(2);

            Assert.AreEqual(4, calculator.Total);
        }
コード例 #2
0
        public void It_should_add_two_calculators_together()
        {
            var calculatorA = new CalculatorInternal();

            calculatorA.Add(2);

            var calculatorB = Substitute.For <ICalculator>();

            calculatorB.Total.Returns(2);

            calculatorA.Add(calculatorB);

            Assert.AreEqual(4, calculatorA.Total);
        }