protected async Task <(AzureBlob Blob, string ImageBlobId, string TestUserBlobId)> SetupAzureBlobAsync(bool setupInitialBlobData = true) { var logger = new NullLogger <AzureBlob>(); var container = Guid.NewGuid().ToString(); // This is so all the files (for this individual test) as isolated into this container. var blob = new AzureBlob("UseDevelopmentStorage=true", container, logger); var imageBlobId = Guid.NewGuid().ToString(); var testUserBlobId = Guid.NewGuid().ToString(); if (setupInitialBlobData) { var image = await File.ReadAllBytesAsync(TestImageName); var tasks = new List <Task>(); tasks.Add(blob.AddAsync(image, imageBlobId)); tasks.Add(blob.AddAsync(TestUser, testUserBlobId)); await Task.WhenAll(tasks); } return(blob, imageBlobId, testUserBlobId); }
protected async Task <AzureBlob> GetAzureBlobAsync(bool setupInitialBlobData = true) { var logger = new NullLogger <AzureBlob>(); var blob = new AzureBlob("UseDevelopmentStorage=true", "test-container", logger); if (setupInitialBlobData) { // Do we have the image already? if (await blob.GetAsync(TestImageName) == null) { var image = await File.ReadAllBytesAsync("2018-tesla-model-x-p100d.jpg"); await blob.AddAsync(image, TestImageName); } if (await blob.GetAsync <SomeFakeUser>(TestClassInstanceName) == null) { await blob.AddAsync(TestUser, TestClassInstanceName); } } return(blob); }