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());
        }
        public void FromStorageFile_EncryptedThrowsNotSupported()
        {
            IStorageFile file = new StorageFileMock();

            Assert.Throws <NotSupportedException>(() => file.CreateSafeFileHandle(FileAccess.ReadWrite, FileShare.Read, FileOptions.Encrypted));
        }
        public void FromStorageFile_InheritableThrowsNotSupported()
        {
            IStorageFile file = new StorageFileMock();

            Assert.Throws <NotSupportedException>(() => file.CreateSafeFileHandle(FileAccess.ReadWrite, FileShare.Inheritable));
        }
        public void FromStorageFile_BadOptionsThrowsOutOfRange()
        {
            IStorageFile file = new StorageFileMock();

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

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

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