Ejemplo n.º 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)));
 }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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)));
        }
Ejemplo n.º 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));
 }
Ejemplo n.º 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)));
        }
Ejemplo n.º 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)));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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)));
        }
Ejemplo n.º 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)));
        }