public void GetTimeSpansFromDayPeriod_For_UK_PM_Test() { const string input = "Europe/London"; var timeZones = TimeSpanConverter.GetTimeSpansFromDayPeriod(DayPeriods.Pm, input); var from = new DateTime(timeZones[0].From); var to = new DateTime(timeZones[0].To); timeZones.Count.Should().Be(1); from.TimeOfDay.Should().BeLessThan(to.TimeOfDay); from.TimeOfDay.Should().Be(GetDateTimeToUtc(new DateTime(1, 1, 1, 12, 0, 0), input).TimeOfDay); to.TimeOfDay.Should().Be(GetDateTimeToUtc(new DateTime(1, 1, 1, 23, 59, 59), input).TimeOfDay); }
public void GetTimeSpansFromDayPeriod_For_US_AM_Test() { const string input = "America/New_York"; var timeZones = TimeSpanConverter.GetTimeSpansFromDayPeriod(DayPeriods.Am, input); var from = new DateTime(timeZones[0].From); var to = new DateTime(timeZones[0].To); // Midnight in US is 05:00:00 // Noon in US is 17:00:00 timeZones.Count.Should().Be(1); from.TimeOfDay.Should().BeLessThan(to.TimeOfDay); from.TimeOfDay.Should().Be(new DateTime(1, 1, 1, 5, 0, 0).TimeOfDay); to.TimeOfDay.Should().Be(new DateTime(1, 1, 1, 17, 0, 0).TimeOfDay); }
public void GetTimeSpansFromDayPeriod_For_NZ_AM_Test() { const string input = "Pacific/Auckland"; var timeZones = TimeSpanConverter.GetTimeSpansFromDayPeriod(DayPeriods.Am, input); var from = new DateTime(timeZones[0].From); var to = new DateTime(timeZones[0].To); timeZones.Count.Should().Be(1); from.TimeOfDay.Should().BeLessThan(to.TimeOfDay); // Noon in NZ is 23:00:00 from.TimeOfDay.Should().Be(new DateTime(1, 1, 1, 11, 0, 0).TimeOfDay); to.TimeOfDay.Should().Be(new DateTime(1, 1, 1, 23, 0, 0).TimeOfDay); }
public void GetTimeSpansFromDayPeriod_For_AUS_PM_Test() { const string input = "Australia/Sydney"; var timeZones = TimeSpanConverter.GetTimeSpansFromDayPeriod(DayPeriods.Pm, input); var from = new DateTime(timeZones[0].From); var to = new DateTime(timeZones[0].To); timeZones.Count.Should().Be(1); from.TimeOfDay.Should().BeLessThan(to.TimeOfDay); // Midnight in AUS is 13:00:00 from.TimeOfDay.Should().Be(new DateTime(1, 1, 1, 01, 0, 0).TimeOfDay); to.TimeOfDay.Should().Be(new DateTime(1, 1, 1, 12, 59, 59).TimeOfDay); }
public void GetTimeSpansFromDayPeriod_For_Singapore_PM_Test() { const string input = "Asia/Singapore"; var timeZones = TimeSpanConverter.GetTimeSpansFromDayPeriod(DayPeriods.Pm, input); var from = new DateTime(timeZones[0].From); var to = new DateTime(timeZones[0].To); timeZones.Count.Should().Be(1); from.TimeOfDay.Should().BeLessThan(to.TimeOfDay); //Midnight in Singapore is 04:00:00 // Noon in NZ is 16:00:00 from.TimeOfDay.Should().Be(new DateTime(1, 1, 1, 04, 0, 0).TimeOfDay); to.TimeOfDay.Should().Be(new DateTime(1, 1, 1, 15, 59, 59).TimeOfDay); }