public void TestCalculateCheckingInterestForAllTransactions() { Transaction[] trx = new Transaction[] { new Transaction(25000, new DateTime(1970, 1, 1)), new Transaction(25000, new DateTime(1970, 2, 1)), new Transaction(25000, new DateTime(1970, 3, 1)), new Transaction(25000, new DateTime(1970, 4, 1)), }; CheckingInterestCalculator calculator = new CheckingInterestCalculator(); double interest = calculator.Calculate(trx, DateTime.MaxValue); Assert.AreEqual(100000.0 * 0.001, interest, DOUBLE_DELTA); }
public void TestCalculateCheckingInterestOnSpecificDate() { Transaction[] trx = new Transaction[] { new Transaction(25000, new DateTime(1970, 1, 1)), new Transaction(25000, new DateTime(1970, 2, 1)), new Transaction(25000, new DateTime(1970, 3, 1)), new Transaction(25000, new DateTime(1970, 4, 1)), }; CheckingInterestCalculator calculator = new CheckingInterestCalculator(); double interest = calculator.Calculate(trx, new DateTime(1970, 2, 15)); Assert.AreEqual(50000.0 * 0.001, interest, DOUBLE_DELTA); interest = calculator.Calculate(trx, new DateTime(1970, 4, 15)); Assert.AreEqual(100000.0 * 0.001, interest, DOUBLE_DELTA); }