Exemple #1
0
        public void CalcInterestIfAmountOver500()
        {
            var calculator = new TesterInterestCalculator();
            calculator.Principal = 500.01;
            calculator.InterestRate = 0.05;
            calculator.Time = 2;
            var bank = new Bank(calculator);

            bank.RunProcessing();
            Assert.IsTrue(calculator.CalculateWasCalled);
        }
Exemple #2
0
        public void DontCalcInterestIfAmountLessThan500()
        {
            var calculator = new TesterInterestCalculator();
            calculator.Principal = 499.99;
            calculator.InterestRate = 0.05;
            calculator.Time = 2;
            var bank = new Bank(calculator);

            bank.RunProcessing();
            Assert.IsFalse(calculator.CalculateWasCalled);
        }
        public void MockDontCalcInterestIfAmountLessThan500()
        {
            var calculator = MockRepository.GenerateMock<SimpleInterestCalculator>();
            calculator.Principal = 499.99;
            calculator.InterestRate = 0.05;
            calculator.Time = 2;

            var bank = new Bank(calculator);

            bank.RunProcessing();

            calculator.AssertWasNotCalled(c => c.CalculateInterestAmount());
        }