예제 #1
0
 public void PrincipalAtTest()
 {
     Deposit d = new Deposit(100000m, 0.12, new DateTime(2015, 1, 1), 12);
     Assert.AreEqual(d.Duration, 12);
     Assert.IsTrue(Math.Abs(d.PrincipalAtMaturity - 112682.5m) < 0.01m);
     Assert.IsTrue(Math.Abs(d.PrincipalAt(new DateTime(2016, 1, 1)) - 112682.5m) < 0.01m);
     Assert.IsTrue(Math.Abs(d.PrincipalAt(new DateTime(2015, 2, 1)) - 101000.0m) < 0.01m);
 }
예제 #2
0
 public void InterestToDateTest()
 {
     Deposit d = new Deposit(100000m, 0.12, new DateTime(2015, 1, 1), 12);
     Assert.AreEqual(d.Duration, 12);
     Assert.IsTrue(Math.Abs(d.TotalInterest - 12682.5m) < 0.01m);
     Assert.IsTrue(Math.Abs(d.InterestToDate(new DateTime(2016, 1, 1)) - 12682.5m) < 0.01m);
     Assert.IsTrue(Math.Abs(d.InterestToDate(new DateTime(2015, 2, 1)) - 1000.0m) < 0.01m);
 }