public void Winter_Date_20181102_1344_in_Mex_must_be_20181102_1744_UTC() { var dateTimeLocalizer = new DateTimeLocalizer(_configuration["TimeZoneId"]); var convertedDate = dateTimeLocalizer.LocalToUtcDateTime(_expectedWinterDate); convertedDate.Should().Be(_dateUtcWinterToTest, "because winter in mexico has -6 UTC"); }
public void Summer_Date_20180627_1244_in_Mex_must_be_20180627_1744_UTC() { var dateTimeLocalizer = new DateTimeLocalizer(_configuration["TimeZoneId"]); var convertedDate = dateTimeLocalizer.LocalToUtcDateTime(_expectedSummerDate); convertedDate.Should().Be(_dateUtcSummerToTest, "because summer in mexico has -5 UTC"); }
public void Utc_to_local_must_handle_date_time_kinds_as_utc() { var dateTimeLocalizer = new DateTimeLocalizer(_configuration["TimeZoneId"]); var utcDate = DateTime.SpecifyKind(_dateUtcSummerToTest, DateTimeKind.Utc); var convertedDate = dateTimeLocalizer.UtcToLocalDateTime(utcDate); var utcUnspecifiedDate = DateTime.SpecifyKind(_dateUtcSummerToTest, DateTimeKind.Unspecified); var convertedUnspecifiedDate = dateTimeLocalizer.UtcToLocalDateTime(utcUnspecifiedDate); convertedDate.Should().Be(convertedUnspecifiedDate, "because DateTime.Kind must be ignored"); }