public void ThrowsFileNotFoundExceptionWhenFileIsAlreadyDeleted() { var file = new PlatformFile(this.platformFile); FileSystemTest.DeletePlatformItem(this.platformFile); AssertEx.Throws <FileNotFoundException>(() => file.Open()); }
public void ThrowsFileNotFoundExceptionWhenFileIsDeleted() { var file = new PlatformFile(this.platformFile); FileSystemTest.DeletePlatformItem(this.platformFile); AssertEx.Throws <FileNotFoundException>(() => { var length = file.Length; }); }
public void ThrowsIOExceptionWhenFileIsAlreadyDeleted() { IPlatformFolder folder = new PlatformFolder(this.storageFolder); FileSystemTest.DeletePlatformItem(this.storageFolder); AssertEx.Throws <DirectoryNotFoundException>(() => folder.Delete()); }
public void ReturnsFalseWhenFolderDoesNotExist() { FileSystemTest.DeletePlatformItem(this.storageFolder); IPlatformFolder folder = new PlatformFolder(this.storageFolder); bool folderExists = folder.Exists(); Assert.IsFalse(folderExists); }
public void ReturnsEmptyEnumerableWhenStorageFolderWasDeleted() { var folder = new PlatformFolder(this.storageFolder); FileSystemTest.DeletePlatformItem(this.storageFolder); IEnumerable <IPlatformFile> files = folder.GetFiles(); Assert.IsNotNull(files); AssertEx.IsEmpty(files); }
public void RecreatesFolderIfItWasDeleted() { var folder = new PlatformFolder(this.storageFolder); FileSystemTest.DeletePlatformItem(this.storageFolder); string fileName = GetUniqueFileName(); folder.CreateFile(fileName); Assert.IsNotNull(FileSystemTest.GetPlatformFile(fileName, this.storageFolder)); }
public void ThrowsFileNotFoundExceptionWhenFileIsAlreadyDeleted() { var file = new PlatformFile(this.platformFile); FileSystemTest.DeletePlatformItem(this.platformFile); string newName = GetUniqueFileName(); AssertEx.Throws <FileNotFoundException>(() => file.Rename(newName)); }
public void ThrowsIOExceptionWhenFileWithDesiredNameAlreadyExists() { var file = new PlatformFile(this.platformFile); string newName = GetUniqueFileName(); var conflictingFile = FileSystemTest.CreatePlatformFile(newName); AssertEx.Throws <IOException>(() => file.Rename(newName)); FileSystemTest.DeletePlatformItem(conflictingFile); }
protected virtual void Dispose(bool disposing) { if (disposing == true) { try { FileSystemTest.DeletePlatformItem(this.platformFile); } catch (IOException) { // File already deleted } } }
protected virtual void Dispose(bool disposing) { if (disposing == true) { try { FileSystemTest.DeletePlatformItem(this.storageFolder); } catch (COMException) { // WinRT exception if Folder is already deleted } catch (IOException) { // !WinRT exception if Folder is already deleted } } }