public void GetCorrectQuote_TwoDifferentOffersAndOneMonth() { mockAllocationProvider.Setup(m => m.GetLoanAllocationsForAmount(It.IsAny <decimal>())) .Returns(new[] { new LoanAllocation { Amount = 100, Rate = 0.12M, }, new LoanAllocation { Amount = 100, Rate = 0.24M } }); var quoteCalculator = new LoanQuoteGenerator(mockAllocationProvider.Object, calculator); var result = quoteCalculator.GetQuote(200, 1); Assert.AreEqual(200, result.LoanAmount, "Incorrect loan amount"); Assert.AreEqual(0.18M, Math.Round(result.InterestRate, 2), "Incorrect interest rate"); Assert.AreEqual(203, result.MonthlyRepayment, "Incorrect monthly repayment"); Assert.AreEqual(203, result.TotalRepayment, "Incorrect total amount"); }
public void GetCorrectQuote_ZeroLoanAmountAndZeroLoanMonths() { mockAllocationProvider.Setup(m => m.GetLoanAllocationsForAmount(It.IsAny <decimal>())) .Returns(new[] { new LoanAllocation { Amount = 100, Rate = 0.12M, } }); var quoteCalculator = new LoanQuoteGenerator(mockAllocationProvider.Object, calculator); var result = quoteCalculator.GetQuote(100, 0); Assert.AreEqual(100, result.LoanAmount, "Incorrect loan amount"); Assert.AreEqual(0, result.InterestRate, "Incorrect interest rate"); Assert.AreEqual(0, result.MonthlyRepayment, "Incorrect monthly repayment"); Assert.AreEqual(0, result.TotalRepayment, "Incorrect total amount"); }