public void RateYear2016_183days() { var year2016_183days = new PeriodItem(new DateTime(2016, 1, 1), new DateTime(2016, 07, 1)); Assert.IsTrue(MathExtensions.AlmostEquals(year2016_183days.AmountOf(PeriodUnit.Month), 6)); Assert.IsTrue(MathExtensions.AlmostEquals(year2016_183days.AmountOf(PeriodUnit.Year), 0.5m)); }
public void RateYear2018() { var year2018 = new PeriodItem(new DateTime(2018, 1, 1), new DateTime(2018, 12, 31)); Assert.IsTrue(MathExtensions.AlmostEquals(year2018.AmountOf(PeriodUnit.Month), 12)); Assert.IsTrue(MathExtensions.AlmostEquals(year2018.AmountOf(PeriodUnit.Year), 1)); }
public void RateYear2017_73days() { var year2017_73days = new PeriodItem(new DateTime(2017, 1, 1), new DateTime(2017, 03, 14)); Assert.IsTrue(MathExtensions.AlmostEquals(year2017_73days.AmountOf(PeriodUnit.Month), 2.4m)); Assert.IsTrue(MathExtensions.AlmostEquals(year2017_73days.AmountOf(PeriodUnit.Year), 0.2m)); }