public void ToStringDoesNotIncludeOffsetWhenConstructedFromUnspecifiedDateTime() { var date = new DateTime(2019, 2, 6, 17, 24, 0, DateTimeKind.Unspecified); var dt = new DATETIMETYPE(date); Assert.AreEqual("2019-02-06T17:24:00", dt.ToString()); }
public void ToStringDoesIncludesOffsetWhenConstructedFromUtcDateTime() { var date = new DateTime(2019, 2, 6, 17, 24, 0, DateTimeKind.Utc); var dt = new DATETIMETYPE(date); Assert.AreEqual("2019-02-06T17:24:00+00:00", dt.ToString(true)); }
public void ToStringIncludesOffsetWhenConstructedFromLocalDateTime() { var date = new DateTime(2019, 2, 6, 17, 24, 0, DateTimeKind.Local); // Note, this will be +00:00, not Z on a UTC machine, because of DateTimeKind.Local var offset = date.ToString(" K").Trim(); var dt = new DATETIMETYPE(date); Assert.AreEqual($"2019-02-06T17:24:00{offset}", dt.ToString(true)); }
public void UsesNoOffsetWhenConstructedFromDateComponentsWithoutOffset() { var dt = new DATETIMETYPE(2019, 2, 6, 17, 24, 0); Assert.AreEqual("2019-02-06T17:24:00", dt.ToString()); }