예제 #1
0
        [PlatformSpecific(TestPlatforms.FreeBSD | TestPlatforms.Linux | TestPlatforms.NetBSD)]  // Filesystem timestamps vary in granularity
        public void GetCreationTime_GetsTime_Unix()
        {
            using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly())
            {
                string file = "GetCreationTime_GetsTime";
                isf.CreateTestFile(file);

                // Filesystem timestamps vary in granularity, we can't make a positive assertion that
                // the time will come before or after the current time.
                Assert.Equal(default(DateTimeOffset).ToLocalTime(), isf.GetCreationTime(file));
            }
        }
예제 #2
0
        public void GetLastAccessTime_GetsTime()
        {
            using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly())
            {
                string file = "GetLastAccessTime_GetsTime";
                isf.CreateTestFile(file);

                // Filesystem timestamps vary in granularity, we can't make a positive assertion that
                // the time will come before or after the current time.
                Assert.True(TestHelper.IsTimeCloseToNow(isf.GetLastAccessTime(file)));
            }
        }
예제 #3
0
        [PlatformSpecific(TestPlatforms.FreeBSD | TestPlatforms.Linux | TestPlatforms.NetBSD)]  // Filesystem timestamps vary in granularity
        public void GetCreationTime_GetsTime_Unix()
        {
            using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly())
            {
                DateTimeOffset before = DateTimeOffset.Now;

                string file = "GetCreationTime_GetsTime";
                isf.CreateTestFile(file);

                DateTimeOffset after = DateTimeOffset.Now;

                DateTimeOffset creationTime = isf.GetCreationTime(file);
                Assert.InRange(creationTime, before.AddSeconds(-10), after.AddSeconds(10)); // +/- 10 for some wiggle room
                Assert.Equal(creationTime, isf.GetCreationTime(file));
            }
        }