Beispiel #1
0
        public void GivenCustomerWhenCustomerIsPresentThenReturnInitialMonthlyPaymentAmount()
        {
            // Arrange
            var mockPremiumCalculator = new Mock <IPremiumCalculator>();

            mockPremiumCalculator.Setup(c => c.CalculateInitialMonthlyPaymentAmount(It.IsAny <decimal>(), It.IsAny <int>())).Returns(4.43M);
            var mockCustomer             = this.GetCustomerMock();
            var premiumCalculatorBuilder = new PremiumCalculatorBuilder(mockPremiumCalculator.Object);

            premiumCalculatorBuilder.SetCustomer(mockCustomer);

            // Act
            premiumCalculatorBuilder.CalculateInitialMonthlyPaymentAmount();

            // Assert
            mockPremiumCalculator.Verify(c => c.CalculateInitialMonthlyPaymentAmount(It.IsAny <decimal>(), It.IsAny <int>()), Times.Once);
            Assert.AreEqual(4.43M, mockCustomer.InitialMonthlyPaymentAmount);
        }