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

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

            premiumCalculatorBuilder.SetCustomer(mockCustomer);

            // Act
            premiumCalculatorBuilder.CalculateOtherMonthlyPaymentsAmount();

            // Assert
            mockPremiumCalculator.Verify(c => c.CalculateOtherMonthlyPaymentsAmount(It.IsAny <decimal>(), It.IsAny <int>()), Times.Once);
            Assert.AreEqual(4.37M, mockCustomer.OtherMonthlyPaymentsAmount);
        }