コード例 #1
0
        public void TestCalLoanInterest(double balance, int increase, int years, List <AnnualAmount> expected)
        {
            var sut    = new CalculateAnnualAmount();
            var result = sut.CalLoanInterest(balance, increase, years);

            result.Should().BeEquivalentTo(expected);
        }
コード例 #2
0
        public void AddLoanInterest([FromBody] AnnualAmount data)
        {
            var cal    = new CalculateAnnualAmount();
            var result = cal.CalLoanInterest(data.PrincipalAmount, data.InterestRate, data.NumberOfYears);

            foreach (var item in result)
            {
                loans.Add(new AnnualAmount()
                {
                    InterestRate    = item.InterestRate,
                    PrincipalAmount = item.PrincipalAmount,
                    NumberOfYears   = item.NumberOfYears,
                    Paid            = item.Paid
                });
            }
        }