Пример #1
0
 [TestCase(500_000, 10, 30, ExpectedResult = 4387.86)]  // Test case #3
 public decimal CalculateCorrectMonthlyRepayment_SimplifiedTestCase(decimal principal,
                                                                    decimal interestRate,
                                                                    int termInYears)
 {
     return(sut.CalculateMonthlyRepayment(new LoanAmount("USD", principal),
                                          interestRate,
                                          new LoanTerm(termInYears)));
 }
Пример #2
0
        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));
        }
Пример #3
0
        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));
        }
Пример #4
0
        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)));
        }
Пример #5
0
 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));
 }
Пример #6
0
        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 decimal CalculateCorrectMonthlyRepayment_CentralizedWithReturn(decimal principal,
                                                                              decimal interestRate,
                                                                              int termInYears)
        {
            var sut = new LoanRepaymentCalculator();

            return(sut.CalculateMonthlyRepayment(
                       new LoanAmount("USD", principal), interestRate, new LoanTerm(termInYears)));
        }
Пример #8
0
        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)));
        }
Пример #9
0
        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));
        }
Пример #11
0
        public decimal CalculateCorrectMontlyRepayment(decimal principal, decimal interestRate, int periodYear)
        {
            var sut = new LoanRepaymentCalculator();

            return(sut.CalculateMonthlyRepayment(new LoanAmount("RSD", principal), interestRate, new LoanTerm(periodYear)));
        }
Пример #12
0
        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)));
        }