コード例 #1
0
        public void FromStorageFile_NoInterfaceReturnsNull()
        {
            // If the provided IStorageFile object can't be cast to the COM interface needed it should return null
            IStorageFile file = new StorageFileMock();

            Assert.Null(file.CreateSafeFileHandle());
        }
コード例 #2
0
        public void FromStorageFile_EncryptedThrowsNotSupported()
        {
            IStorageFile file = new StorageFileMock();

            Assert.Throws <NotSupportedException>(() => file.CreateSafeFileHandle(FileAccess.ReadWrite, FileShare.Read, FileOptions.Encrypted));
        }
コード例 #3
0
        public void FromStorageFile_InheritableThrowsNotSupported()
        {
            IStorageFile file = new StorageFileMock();

            Assert.Throws <NotSupportedException>(() => file.CreateSafeFileHandle(FileAccess.ReadWrite, FileShare.Inheritable));
        }
コード例 #4
0
        public void FromStorageFile_BadOptionsThrowsOutOfRange()
        {
            IStorageFile file = new StorageFileMock();

            AssertExtensions.Throws <ArgumentOutOfRangeException>("options", () => file.CreateSafeFileHandle(FileAccess.ReadWrite, FileShare.Read, (FileOptions)100));
        }
コード例 #5
0
        public void FromStorageFile_BadAccessThrowsOutOfRange()
        {
            IStorageFile file = new StorageFileMock();

            AssertExtensions.Throws <ArgumentOutOfRangeException>("access", () => file.CreateSafeFileHandle((FileAccess)100));
        }
コード例 #6
0
        public void FromStorageFile_BadSharingThrowsOutOfRange()
        {
            IStorageFile file = new StorageFileMock();

            Assert.Throws <ArgumentOutOfRangeException>("share", () => file.CreateSafeFileHandle(FileAccess.ReadWrite, (FileShare)100));
        }