public async Task CreateDeleteFileShare() { //create file share string fileShareName = Recording.GenerateAssetName("testfileshare"); FileShare share1 = (await _fileShareCollection.CreateOrUpdateAsync(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.CheckIfExistsAsync(fileShareName)); Assert.IsFalse(await _fileShareCollection.CheckIfExistsAsync(fileShareName + "1")); //delete file share await share1.DeleteAsync(); //validate if deleted successfully FileShare fileShare3 = await _fileShareCollection.GetIfExistsAsync(fileShareName); Assert.IsNull(fileShare3); Assert.IsFalse(await _fileShareCollection.CheckIfExistsAsync(fileShareName)); }
public async Task GetIfExist() { #region Snippet:Managing_FileShares_GetFileShareIFExists FileShareCollection fileShareCollection = fileService.GetFileShares(); FileShare fileShare = await fileShareCollection.GetIfExistsAsync("foo"); if (fileShare != null) { Console.WriteLine(fileShare.Id.Name); } if (await fileShareCollection.CheckIfExistsAsync("bar")) { Console.WriteLine("file share 'bar' exists"); } #endregion }