public void OnceIn() { // Arrange var now = DateTime.Today; var calculator = new TimeCalculator(); var run = new RunSpecifier(calculator); // Act run.OnceIn(10).Seconds(); var actual = calculator.Calculate(now); // Assert Assert.AreEqual(now.AddSeconds(10), actual); // Act actual = calculator.Calculate(now); // Assert Assert.AreEqual(null, actual); }
public void OnceInTimeSpan() { // Arrange var now = DateTime.Today; var time = TimeSpan.FromSeconds(10); var calculator = new TimeCalculator(); var run = new RunSpecifier(calculator); // Act run.OnceIn(time); var calculated = calculator.Calculate(now); // Assert Assert.AreEqual(now.Add(time), calculated); // Act calculated = calculator.Calculate(now); // Assert Assert.AreEqual(null, calculated); }