public async Task Crud() { ICommand uploadCommand = new UploadBlobFromStreamCommand(); ICommand downloadCommand = new DownloadBlobToStreamCommand(); ICommand deleteBlobCommand = new DeleteBlobCommand(); ICommand deleteContainerCommand = new DeleteContainerCommand(); var fileName = Guid.NewGuid() + ".txt"; var content = DateTime.Now.ToString(CultureInfo.CurrentCulture); // upload dynamic p = new ExpandoObject(); p.Container = await Fixture.AzureStorage.GetContainerReferenceAsync(_tempContainerName); p.Stream = content.ToMemoryStream(); p.BlobName = fileName; await uploadCommand.ExecuteAsync(p); // download dynamic pd = new ExpandoObject(); pd.Container = await Fixture.AzureStorage.GetContainerReferenceAsync(_tempContainerName); pd.BlobName = fileName; await downloadCommand.ExecuteAsync(pd); MemoryStream ms = pd.Stream; var download = ms.ToStringFromMemoryStream(); Assert.Equal(content, download); // delete dynamic pdd = new ExpandoObject(); pdd.Container = await Fixture.AzureStorage.GetContainerReferenceAsync(_tempContainerName); pdd.BlobName = fileName; await deleteBlobCommand.ExecuteAsync(pdd); await deleteContainerCommand.ExecuteAsync(p); }
public bool Delete(DeleteContainerCommand command) => _mediator.Send(command).Result;