Esempio n. 1
0
        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());
        }
Esempio n. 2
0
        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));
        }
Esempio n. 3
0
        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));
        }
Esempio n. 4
0
        public void UsesNoOffsetWhenConstructedFromDateComponentsWithoutOffset()
        {
            var dt = new DATETIMETYPE(2019, 2, 6, 17, 24, 0);

            Assert.AreEqual("2019-02-06T17:24:00", dt.ToString());
        }