public void CheckFileTokenStartingWithSlash(string fileName) { DirectoryFileStore store = new DirectoryFileStore("test", new DirectoryFileStoreConfig { BasePath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) }); Assert.Equal("file://test" + fileName, store.CreateFileToken(fileName).Result); }
public void CheckCreateAndDeleteFile(string fileName) { DirectoryFileStore store = new DirectoryFileStore("test", new DirectoryFileStoreConfig { BasePath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) }); var token = store.CreateFileToken(fileName).Result; using (var stream = store.OpenWrite(token).Result) using (var writer = new StreamWriter(stream)) { writer.Write("hello"); } Assert.True(store.Exists(token).Result); Assert.Equal("hello", File.ReadAllText(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), fileName))); store.Delete(token).Wait(); Assert.False(store.Exists(token).Result); }