public void Months() { // Arrange var now = DateTime.Now; var calculator = new TimeCalculator(); var run = new RunSpecifier(calculator); // Act run.Every(5).Months(); var calculated = calculator.Calculate(now); // Assert Assert.AreEqual(now.AddMonths(5).Month, calculated.Value.Month); }
public void Weeks() { // Arrange var now = DateTime.Now; var calculator = new TimeCalculator(); var run = new RunSpecifier(calculator); // Act run.Every(5).Weeks(); var calculated = calculator.Calculate(now); // Assert Assert.AreEqual(now.AddDays(35), calculated.Value); }
public void On() { // Arrange var calculator = new TimeCalculator(); var run = new RunSpecifier(calculator); var now = DateTime.Now; var expectedDay = 3; // Act run.Every(1).Months().On(expectedDay); var calculated = calculator.Calculate(now); // Assert Assert.AreEqual(expectedDay, calculated.Value.Day); }
public void OnTheFourthDay() { // Arrange var calculator = new TimeCalculator(); var run = new RunSpecifier(calculator); var now = new DateTime(2017, 10, 27); var expectedDate = new DateTime(2017, 11, 24); // Act run.Every(1).Months().OnTheFourthDay(DayOfWeek.Friday); var calculated = calculator.Calculate(now); // Assert Assert.AreEqual(DayOfWeek.Friday, calculated.Value.DayOfWeek); Assert.AreEqual(expectedDate, calculated.Value.Date); }