public void XamlServicesSave_ShouldSerialiseToISO8601_GivenDateEndingWithZero() { var testData = new TestDateTimeDto { Created = new DateTime(2015, 12, 30) }; var result = XamlServices.Save(testData); Console.WriteLine(result); Assert.IsTrue(result.Contains("2015-12-30")); }
public void XamlServicesSave_ShouldSerialiseToISO8601_GivenUtcDateTime() { var testData = new TestDateTimeDto { Created = new DateTime(2015, 12, 30, 23, 50, 51, DateTimeKind.Utc) }; var result = XamlServices.Save(testData); Console.WriteLine(result); Assert.IsTrue(result.Contains("2015-12-30T23:50:51Z")); }
public void XamlServicesSave_ShouldSerialiseToISO8601_GivenLocalisedDateTimeWithMilliseconds() { var usTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time"); var localisedDateTime = TimeZoneInfo.ConvertTimeFromUtc( new DateTime(2015, 12, 30, 23, 50, 51, DateTimeKind.Utc), usTimeZone); var testData = new TestDateTimeDto { Created = localisedDateTime }; testData.Created = testData.Created.AddMilliseconds(11); var result = XamlServices.Save(testData); Console.WriteLine(result); Assert.IsTrue(result.Contains("2015-12-30T15:50:51.011")); }