public decimal CalculateCorrectMonthlyRepayment_return(decimal principal, decimal interestRate, int term) { var loan = new LoanRepaymentCalculator(); double act = (double)loan.CalculateMonthlyRepayment(new LoanAmount("USD", principal), interestRate, new LoanTerm(term)); return(new decimal(Math.Round(act, 2, MidpointRounding.AwayFromZero))); }
public void CalculateCorrectMonthlyRepayment_Centralized(decimal principal, decimal interestRate, int termInYears, decimal expectedMonthlyPayment) { var sut = new LoanRepaymentCalculator(); var monthlyPayment = sut.CalculateMonthlyRepayment(new LoanAmount("USD", principal), interestRate, new LoanTerm(termInYears)); Assert.That(monthlyPayment, Is.EqualTo(expectedMonthlyPayment)); }
public void CalculateCorrectMonthlyRepayment_csv(decimal principal, decimal interestRate, int term, decimal expectedValue) { var loan = new LoanRepaymentCalculator(); var act = loan.CalculateMonthlyRepayment(new LoanAmount("USD", principal), interestRate, new LoanTerm(term)); Assert.That(act, Is.EqualTo(expectedValue)); }
public void CalculateCorrectMonthlyRepayment_10Percent() { var sut = new LoanRepaymentCalculator(); var monthlyPayment = sut.CalculateMonthlyRepayment(new LoanAmount("USD", 200_000), 10m, new LoanTerm(30)); Assert.That(monthlyPayment, Is.EqualTo(1755.14)); }
public void CalculateCorrectMonthlyRepayment_GenerateTestData( [Values(100000, 200000)] decimal principal, [Values(5, 6)] decimal interestRate, [Values(20, 30)] int term) { var loan = new LoanRepaymentCalculator(); var act = loan.CalculateMonthlyRepayment(new LoanAmount("USD", principal), interestRate, new LoanTerm(term)); }
public decimal CalculateCorrectMonthlyRepayment_Param_Reture_Data(decimal principal, decimal interestRate, int termYears) { var sut = new LoanRepaymentCalculator(); return(sut.CalculatorMonthlyRepayment( new LoanAmount("USD", principal), interestRate, new LoanTerm(termYears))); }
public decimal CalculateCorrectMonthlyRepayment_CentralizedWithReturn(decimal principal, decimal interestRate, int termInYears) { var sut = new LoanRepaymentCalculator(); return(sut.CalculateMonthlyRepayment( new LoanAmount("USD", principal), interestRate, new LoanTerm(termInYears))); }
public decimal CalculateCorrectMonthlyRepayment_Simplified( decimal principal, decimal interestRate, int termInYears) { var calculator = new LoanRepaymentCalculator(); return(calculator.CalculateMonthlyRepayment(new LoanAmount("USD", principal), interestRate, new LoanTerm(termInYears))); }
public void CalculateCorrectMontlyRepayment_Range( [Range(50000, 1000000, 50000)] decimal principal, [Range(0.5, 20.00, 0.5)] decimal interestRate, [Values(10, 20, 30)] int periodYear) { var sut = new LoanRepaymentCalculator(); sut.CalculateMonthlyRepayment(new LoanAmount("RSD", principal), interestRate, new LoanTerm(periodYear)); }
public void ReturnComparisonForFirstProduct() { List <MonthlyRepaymentComparsion> comparsions = sut.CompareMonthlyRepayments(new LoanTerm(30)); var repayment = new LoanRepaymentCalculator().CalculatorMonthlyRepayment(new LoanAmount("USD", 200_000m), 1, new LoanTerm(30)); var expectedProduct = new MonthlyRepaymentComparsion("a", 1, repayment); // Assert.That(comparsions, Does.Contain(comparsions[0])); Assert.That(comparsions, Does.Contain(expectedProduct)); }
public void CalculateCorrectMonthlyRepayment_Combinatorial( [Values(10000, 20000, 30000)] decimal principal, [Values(6.5, 10, 20)] decimal interestRate, [Values(10, 20, 30)] int termYears) { // 27种结果 var sut = new LoanRepaymentCalculator(); var monthlyPayment = sut.CalculatorMonthlyRepayment( new LoanAmount("USD", principal), interestRate, new LoanTerm(termYears)); }
public void CalculateCorrectMonthlyRepayment_Range( [Range(50000, 10000000, 50000)] decimal principal, [Range(0.5, 20, 0.5)] decimal interestRate, [Values(10, 20, 30)] int termYears) { // 2400种 var sut = new LoanRepaymentCalculator(); var monthlyPayment = sut.CalculatorMonthlyRepayment( new LoanAmount("USD", principal), interestRate, new LoanTerm(termYears)); }
public void CalculateCorrectMontlyRepayment_Sequential( [Values(200000, 200000, 500000)] decimal principal, [Values(6.5, 10, 10)] decimal interestRate, [Values(30, 30, 30)] int periodYear, [Values(1264.14, 1755.14, 4387.86)] decimal expectedRes) { var sut = new LoanRepaymentCalculator(); var monthlyPayment = sut.CalculateMonthlyRepayment(new LoanAmount("RSD", principal), interestRate, new LoanTerm(periodYear)); Assert.That(monthlyPayment, Is.EqualTo(expectedRes)); }
public decimal CalculateCorrectMonthlyRepayment_CentralizeWithReturn(decimal principal, decimal interestRate, int termInYears) { var sut = new LoanRepaymentCalculator(); return(sut.CalculateMonthlyRepayment( new LoanAmount("USD", principal), interestRate, new LoanTerm(termInYears))); //Assert.That(monthlyPayment, Is.EqualTo(expectedMonthlyPayment)); }
public void CalculateCorrectMonthlyRepayment_Sequential( [Values(10000, 20000, 30000)] decimal principal, [Values(6.5, 10, 20)] decimal interestRate, [Values(10, 20, 30)] int termYears, [Values(390000, 390000, 390000)] decimal expectedMontlyPayment) { // 3中结果 var sut = new LoanRepaymentCalculator(); var monthlyPayment = sut.CalculatorMonthlyRepayment( new LoanAmount("USD", principal), interestRate, new LoanTerm(termYears)); Assert.That(monthlyPayment, Is.EqualTo(expectedMontlyPayment)); }
public decimal CalculateCorrectMontlyRepayment(decimal principal, decimal interestRate, int periodYear) { var sut = new LoanRepaymentCalculator(); return(sut.CalculateMonthlyRepayment(new LoanAmount("RSD", principal), interestRate, new LoanTerm(periodYear))); }
public void OneTimeSetup() { sut = new LoanRepaymentCalculator(); }
public void OneTimeTearDown() { sut = null; }
public decimal CalculateCorrectMonthlyRepayment_simplifiedTestCase(decimal principal, decimal interestrate, int termYears) { var sut = new LoanRepaymentCalculator(); return(sut.CalculateMonthlyRepayment(new LoanAmount("USD", principal), interestrate, new LoanTerm(termYears))); }