public void OnXDayFrequencyComputeNextDateTest4() { OnXDayFrequency freq = new OnXDayFrequency(); freq.DayOfWeek = DayOfWeek.Wednesday; freq.RankingPosition = RankingPosition.Fourth; DateTime referenceDate = new DateTime(2013, 2, 5); DateTime result = freq.ComputeNextDate(referenceDate); Assert.AreEqual(new DateTime(2013, 2, 27), result); referenceDate = new DateTime(2013, 2, 28); result = freq.ComputeNextDate(referenceDate); Assert.AreEqual(new DateTime(2013, 3, 27), result); }
public void OnXDayFrequencyComputeNextDateTest1() { OnXDayFrequency freq = new OnXDayFrequency(); freq.DayOfWeek = DayOfWeek.Monday; freq.RankingPosition = RankingPosition.First; DateTime referenceDate = new DateTime(2013, 1, 1); DateTime result = freq.ComputeNextDate(referenceDate); Assert.AreEqual(new DateTime(2013, 1, 7), result); referenceDate = new DateTime(2013, 1, 10); result = freq.ComputeNextDate(referenceDate); Assert.AreEqual(new DateTime(2013, 2, 4), result); }
public void OnXDayFrequencyComputeNextDateTest5() { OnXDayFrequency freq = new OnXDayFrequency(); freq.DayOfWeek = DayOfWeek.Tuesday; freq.RankingPosition = RankingPosition.Last; DateTime referenceDate = new DateTime(2013, 2, 5); DateTime result = freq.ComputeNextDate(referenceDate); Assert.AreEqual(new DateTime(2013, 2, 26), result); referenceDate = new DateTime(2013, 2, 28); result = freq.ComputeNextDate(referenceDate); Assert.AreEqual(new DateTime(2013, 3, 26), result); referenceDate = new DateTime(2013, 3, 27); result = freq.ComputeNextDate(referenceDate); // It's the fifth tuesday in April Assert.AreEqual(new DateTime(2013, 4, 30), result); }