Exemple #1
0
        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)));
        }
Exemple #2
0
        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));
        }
Exemple #3
0
        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));
        }
Exemple #4
0
        public void CalculateCorrectMonthlyRepayment_Param_CsvData(decimal principal,
                                                                   decimal interestRate,
                                                                   int termYears,
                                                                   decimal expectedMontlyPayment)
        {
            var sut = new LoanRepaymentCalculator();

            var monthlyPayment = sut.CalculatorMonthlyRepayment(
                new LoanAmount("USD", principal), interestRate, new LoanTerm(termYears));

            Assert.That(monthlyPayment, Is.EqualTo(expectedMontlyPayment));
        }
Exemple #5
0
        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));
        }