public void WhenGetFileInSubDirectoryFromRoot_ThenFilesDirectoryIsTheSubDirectory() { storage.CreateDirectory("test/sub"); WriteFile("test/sub/file.txt"); var root = new IsolatedStorageDirectory(() => storage); var file = root.GetFile("test/sub/file.txt"); file.Directory.FullPath.ShouldEqual("~/test/sub"); }
public void GetFileReturnsWrapper() { storage.CreateFile("test.js").Close(); var directory = new IsolatedStorageDirectory(storage); var file = directory.GetFile("test.js"); file.ShouldBeType<IsolatedStorageFile>(); file.FullPath.ShouldEqual("~/test.js"); file.Directory.ShouldBeSameAs(directory); }
public void GetFileReturnsWrapper() { storage.CreateFile("test.js").Close(); var directory = new IsolatedStorageDirectory(() => storage); var file = directory.GetFile("test.js"); file.ShouldBeType <IsolatedStorageFile>(); file.FullPath.ShouldEqual("~/test.js"); file.Directory.ShouldBeSameAs(directory); }
public void IsolatedStorageFileSystem_AccessesIsolatedStorage() { using (var store = IsolatedStorageFile.GetMachineStoreForAssembly()) { using (var writer = new StreamWriter(store.OpenFile("test.txt", FileMode.Create, FileAccess.Write))) { writer.Write("test"); writer.Flush(); } var directory = new IsolatedStorageDirectory(store); var file = directory.GetFile("test.txt"); file.Exists.ShouldBeTrue(); using (var reader = new StreamReader(file.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite))) { reader.ReadToEnd().ShouldEqual("test"); } file.Delete(); store.FileExists("test.txt").ShouldBeFalse(); } }