public void Given_Null_Parameters_When_SetSchemaAsync_Invoked_Then_It_Should_Throw_Exception() { var schema = "{ \"lorem\": \"ipsum\" }"; var instance = new BlobStorageSchemaSink(); var func = default(Func <Task>); func = async() => await instance.SetSchemaAsync(null, null).ConfigureAwait(false); func.Should().Throw <ArgumentNullException>(); func = async() => await instance.SetSchemaAsync(schema, null).ConfigureAwait(false); func.Should().Throw <ArgumentNullException>(); }
public async Task Given_Blob_When_SetSchemaAsync_Invoked_Then_It_Should_Return_Result(string container, string path, string schema) { var account = CloudStorageAccount.DevelopmentStorageAccount; var blobClient = account.CreateCloudBlobClient(); var blobContainer = blobClient.GetContainerReference(container); await blobContainer.CreateIfNotExistsAsync().ConfigureAwait(false); var blob = blobContainer.GetBlockBlobReference(path); await blob.UploadTextAsync(schema).ConfigureAwait(false); var instance = new BlobStorageSchemaSink(blobClient) .WithContainer(container); var result = await instance.SetSchemaAsync(schema, path).ConfigureAwait(false); result.Should().BeTrue(); await blob.DeleteIfExistsAsync().ConfigureAwait(false); await blobClient.GetContainerReference(container) .DeleteIfExistsAsync() .ConfigureAwait(false); }