public void OnceAtDateTime() { // Arrange var now = DateTime.Now; var at = new DateTime(2000, 10, 10, 10, 10, 10); var calculator = new TimeCalculator(); var run = new RunSpecifier(calculator); // Act run.OnceAt(at); var calculated = calculator.Calculate(now); // Assert Assert.AreEqual(at, calculated); // Act calculated = calculator.Calculate(now); // Assert Assert.AreEqual(null, calculated); }
public void OnceAtAndEvery() { // Arrange var now = DateTime.Now; var at = new DateTime(2000, 10, 10, 10, 10, 10); var calculator = new TimeCalculator(); var run = new RunSpecifier(calculator); // Act run.OnceAt(at).AndEvery(10).Seconds(); var calculated = calculator.Calculate(now); // Assert Assert.AreEqual(at, calculated); // Act calculated = calculator.Calculate(now); // Assert Assert.AreEqual(now.AddSeconds(10), calculated); }
public void OnceAtTimeSpan() { // Arrange var now = DateTime.Today; var at = new TimeSpan(13, 50, 0); var calculator = new TimeCalculator(); var run = new RunSpecifier(calculator); // Act run.OnceAt(at); var calculated = calculator.Calculate(now); // Assert Assert.AreEqual(now.Add(at), calculated); // Act calculated = calculator.Calculate(now); // Assert Assert.AreEqual(null, calculated); }
public void OnceAtHoursMinutes() { // Arrange var now = DateTime.Today; var hours = 13; var minutes = 50; var calculator = new TimeCalculator(); var run = new RunSpecifier(calculator); // Act run.OnceAt(hours, minutes); var calculated = calculator.Calculate(now); // Assert Assert.AreEqual(now.Date.AddHours(hours).AddMinutes(minutes), calculated); // Act calculated = calculator.Calculate(now); // Assert Assert.AreEqual(null, calculated); }