Esempio n. 1
0
        public void ToStringTest()
        {
            var st3 = new SYSTEMTIME(DateTime.Today);

            Assert.That(st3.ToString(), Is.EqualTo(DateTime.Today.ToString()));
            Assert.That(st3.GetHashCode(), Is.Not.EqualTo(SYSTEMTIME.MinValue.GetHashCode()));
        }
Esempio n. 2
0
        public void SystemTimeToFileTimeTest()
        {
            var dt = new DateTime(2000, 1, 1, 4, 4, 4, 444, DateTimeKind.Utc);
            var st = new SYSTEMTIME(dt, DateTimeKind.Utc);

            Assert.That(st.ToString(DateTimeKind.Utc, null, null), Is.EqualTo(dt.ToString()));
            Assert.That(SystemTimeToFileTime(st, out var ft), ResultIs.Successful);
            Assert.That(FileTimeExtensions.Equals(ft, dt.ToFileTimeStruct()));
        }
Esempio n. 3
0
        public void SystemTimeToFileTimeTest()
        {
            var dt = new DateTime(2000, 1, 1, 4, 4, 4, 444, DateTimeKind.Utc);
            var st = new SYSTEMTIME(dt, DateTimeKind.Utc);

            Assert.That(st.ToString(DateTimeKind.Utc, null, null), Is.EqualTo(dt.ToString()));
            var ft = new System.Runtime.InteropServices.ComTypes.FILETIME();
            var b  = SystemTimeToFileTime(ref st, ref ft);

            Assert.That(b, Is.True);
            Assert.That(FileTimeExtensions.Equals(ft, dt.ToFileTimeStruct()));
        }