public async Task CreateDeleteFileShare() { //create file share string fileShareName = Recording.GenerateAssetName("testfileshare"); FileShare share1 = (await _fileShareCollection.CreateOrUpdateAsync(true, fileShareName, new FileShareData())).Value; Assert.AreEqual(share1.Id.Name, fileShareName); //validate if created successfully FileShareData shareData = share1.Data; Assert.IsEmpty(shareData.Metadata); FileShare share2 = await _fileShareCollection.GetAsync(fileShareName); AssertFileShareEqual(share1, share2); Assert.IsTrue(await _fileShareCollection.ExistsAsync(fileShareName)); Assert.IsFalse(await _fileShareCollection.ExistsAsync(fileShareName + "1")); //delete file share await share1.DeleteAsync(true); //validate if deleted successfully FileShare fileShare3 = await _fileShareCollection.GetIfExistsAsync(fileShareName); Assert.IsNull(fileShare3); Assert.IsFalse(await _fileShareCollection.ExistsAsync(fileShareName)); }
public async Task CreateDeleteFileShare() { //create file share string fileShareName = Recording.GenerateAssetName("testfileshare"); FileShareResource share1 = (await _fileShareCollection.CreateOrUpdateAsync(WaitUntil.Completed, fileShareName, new FileShareData())).Value; Assert.AreEqual(share1.Id.Name, fileShareName); //validate if created successfully FileShareData shareData = share1.Data; Assert.IsEmpty(shareData.Metadata); FileShareResource share2 = await _fileShareCollection.GetAsync(fileShareName); AssertFileShareEqual(share1, share2); Assert.IsTrue(await _fileShareCollection.ExistsAsync(fileShareName)); Assert.IsFalse(await _fileShareCollection.ExistsAsync(fileShareName + "1")); //delete file share await share1.DeleteAsync(WaitUntil.Completed); //validate if deleted successfully var exception = Assert.ThrowsAsync <RequestFailedException>(async() => { await _fileShareCollection.GetAsync(fileShareName); }); Assert.AreEqual(404, exception.Status); Assert.IsFalse(await _fileShareCollection.ExistsAsync(fileShareName)); }
public async Task Get() { #region Snippet:Managing_FileShares_GetFileShare FileShareCollection fileShareCollection = fileService.GetFileShares(); FileShareResource fileShare = await fileShareCollection.GetAsync("myFileShare"); Console.WriteLine(fileShare.Id.Name); #endregion }
public async Task Delete() { #region Snippet:Managing_FileShares_DeleteFileShare FileShareCollection fileShareCollection = fileService.GetFileShares(); FileShareResource fileShare = await fileShareCollection.GetAsync("myFileShare"); await fileShare.DeleteAsync(WaitUntil.Completed); #endregion }
public async Task Delete() { #region Snippet:Managing_FileShares_DeleteFileShare FileShareCollection fileShareCollection = fileService.GetFileShares(); FileShare fileShare = await fileShareCollection.GetAsync("myFileShare"); await fileShare.DeleteAsync(true); #endregion }