Ejemplo n.º 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());
        }
Ejemplo n.º 2
0
        public void FromStorageFile_EncryptedThrowsNotSupported()
        {
            IStorageFile file = new StorageFileMock();

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

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

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

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

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