public void ThrowsIOExceptionWhenFileWithThatNameAlreadyExists() { string fileName = GetUniqueFileName(); FileSystemTest.CreatePlatformFile(fileName, this.storageFolder); var folder = new PlatformFolder(this.storageFolder); AssertEx.Throws <IOException>(() => folder.CreateFile(fileName)); }
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); }
public void ReturnsEnumerableOfObjectsRepresentingExistingFiles() { string[] expectedFileNames = new string[] { "file.1", "blah.txt", "foo.bar" }; foreach (string fileName in expectedFileNames) { FileSystemTest.CreatePlatformFile(fileName, this.storageFolder); } var folder = new PlatformFolder(this.storageFolder); IEnumerable <IPlatformFile> files = folder.GetFiles(); AssertEx.AreEqual(expectedFileNames.OrderBy(name => name), files.Select(f => f.Name).OrderBy(name => name)); }
public PlatformFileTest() { string uniqueFileName = GetUniqueFileName(); this.platformFile = FileSystemTest.CreatePlatformFile(uniqueFileName); }