Exemplo n.º 1
0
        public async Task CreateDeleteFileShare()
        {
            //create file share
            string    fileShareName = Recording.GenerateAssetName("testfileshare");
            FileShare share1        = (await _fileShareContainer.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 _fileShareContainer.GetAsync(fileShareName);

            AssertFileShareEqual(share1, share2);
            Assert.IsTrue(await _fileShareContainer.CheckIfExistsAsync(fileShareName));
            Assert.IsFalse(await _fileShareContainer.CheckIfExistsAsync(fileShareName + "1"));

            //delete file share
            await share1.DeleteAsync();

            //validate if deleted successfully
            FileShare fileShare3 = await _fileShareContainer.GetIfExistsAsync(fileShareName);

            Assert.IsNull(fileShare3);
            Assert.IsFalse(await _fileShareContainer.CheckIfExistsAsync(fileShareName));
        }
        public async Task Get()
        {
            #region Snippet:Managing_FileShares_GetFileShare
            FileShareContainer fileShareContainer = fileService.GetFileShares();
            FileShare          fileShare          = await fileShareContainer.GetAsync("myFileShare");

            Console.WriteLine(fileShare.Id.Name);
            #endregion
        }
        public async Task Delete()
        {
            #region Snippet:Managing_FileShares_DeleteFileShare
            FileShareContainer fileShareContainer = fileService.GetFileShares();
            FileShare          fileShare          = await fileShareContainer.GetAsync("myFileShare");

            await fileShare.DeleteAsync();

            #endregion
        }