public void GetNextStop_ServerInNonCentralTimeZone_Ok() { // Arrange var stack = new Stack { ScheduleId = Guid.NewGuid() }; var schedule = new Schedule { Id = stack.ScheduleId, StopCron = "* 18 * * 1-5" }; ScheduleRepositoryMock.Setup(x => x.Find(schedule.Id)).Returns(schedule); var oneOClockEastern = new DateTime(2015, 10, 1, 13, 0, 0); var easternTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"); oneOClockEastern = TimeZoneInfo.ConvertTime(oneOClockEastern, easternTimeZone); ClockMock.Setup(x => x.Now).Returns(oneOClockEastern); // == 2 PM central var expected = new TimeSpan(4, 0, 0); // Act var result = Calculator.GetNextStop(stack); // Assert result.Should().Be(expected); }
public void GetNextStop_Ok() { // Arrange var stack = new Stack { ScheduleId = Guid.NewGuid() }; var schedule = new Schedule { Id = stack.ScheduleId, StopCron = "* 18 * * 1-5" }; ScheduleRepositoryMock.Setup(x => x.Find(schedule.Id)).Returns(schedule); ClockMock.Setup(x => x.Now).Returns(new DateTime(2015, 10, 1, 17, 0, 0)); var expected = new TimeSpan(1, 0, 0); // Act var result = Calculator.GetNextStop(stack); // Assert result.Should().Be(expected); }