示例#1
0
        public void TestSimpleInterestCalc()
        {
            var interest_10 = _interestCalculator.ComputeInterest(100, 0.10m);
            var interest_05 = _interestCalculator.ComputeInterest(100, 0.05m);
            var interest_01 = _interestCalculator.ComputeInterest(100, 0.01m);

            Assert.AreEqual(10, interest_10); //Visa
            Assert.AreEqual(5, interest_05);  // MC
            Assert.AreEqual(1, interest_01);  // Discover
        }
 private BalanceInterest GenerateBalanceInterest(decimal balance, decimal interestRate)
 => new BalanceInterest
 {
     Balance         = balance,
     InterestPercent = interestRate,
     Interest        = balance < 0 ? 0 : _interestCalculator.ComputeInterest(balance, interestRate) // computes interest base don calc injected
 };