Skip to content
This repository has been archived by the owner on Jan 24, 2021. It is now read-only.

Altered datetime serialisation tests to cope with offsets better #2385

Merged
merged 1 commit into from Mar 29, 2016

Conversation

jchannon
Copy link
Member

With the Easter 2016 clocks going forward the serialisation tests for DateTime failed.

The serialiser converts Unspecified dates to Local and then formats using the ToString("o") formatter.

This will append the timezone differences if a date is Local.

This PR uses the recommended TimeZoneInfo.Local.GetUtcOffset(myDate); to find the timezone offset. We then use this in the tests to assert the value the serialiser's ToString("o") formatter returns with the datetime passed into the SUT.

@jchannon jchannon added this to the 2.0-beta milestone Mar 28, 2016
@jchannon jchannon changed the title Altered datetime serialization tests to cope with offsets better Altered datetime serialisation tests to cope with offsets better Mar 28, 2016
@thecodejunkie thecodejunkie merged commit 4523807 into NancyFx:master Mar 29, 2016
@jchannon jchannon deleted the datetimeserializerfixes branch March 29, 2016 13:37
@xt0rted
Copy link
Contributor

xt0rted commented Apr 30, 2016

When I run these tests (en-US & -4 eastern daylight) I'm getting two failing at NancySerializationStrategyFixture.cs#L80-112

Should_serialize_unspecified_datetime_object

Expected: 2014-03-09T17:03:25.2340000+-04:00
Actual:   2014-03-09T17:03:25.2340000-04:00

Should_serialize_local_datetime_object

Expected: 2014-03-09T17:03:25.2340000+-04:00
Actual:   2014-03-09T17:03:25.2340000-04:00

@jchannon
Copy link
Member Author

Those expected values look,um, interesting :)

On Saturday, 30 April 2016, Brian Surowiec notifications@github.com wrote:

When I run these tests (en-US & -4 eastern daylight) I'm getting two
failing at NancySerializationStrategyFixture.cs#L80-112
https://github.com/NancyFx/Nancy/blob/2c07700b2d999d20c60f524480c48b2dc19b678c/test/Nancy.Tests/Unit/Json/Simple/NancySerializationStrategyFixture.cs#L80-112

Should_serialize_unspecified_datetime_object

Expected: 2014-03-09T17:03:25.2340000+-04:00
Actual: 2014-03-09T17:03:25.2340000-04:00

Should_serialize_local_datetime_object

Expected: 2014-03-09T17:03:25.2340000+-04:00
Actual: 2014-03-09T17:03:25.2340000-04:00


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#2385 (comment)

@jchannon
Copy link
Member Author

jchannon commented May 4, 2016

Need to test those when #2427 is complete

@xt0rted
Copy link
Contributor

xt0rted commented Aug 2, 2016

The issue above has been fixed in #2525

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants