public async Task RespondsToEnqueuedItem() { var marker = new MarkerMessage { MarkerId = Guid.NewGuid() }; string json = JsonConvert.SerializeObject(marker); CloudQueueClient queueClient = StorageAccount.CreateCloudQueueClient(); CloudQueue queue = queueClient.GetQueueReference("testqueue"); await queue.AddMessageAsync(new CloudQueueMessage(json)); await marker.Assert(); }
public async Task OutputToTableBinding() { MarkerMessage marker = new MarkerMessage { MarkerId = Guid.NewGuid() }; string json = JsonConvert.SerializeObject(marker); byte[] body = Encoding.UTF8.GetBytes(json); IQueueClient queueClient = new QueueClient(Settings.ServiceBusConnectionString, "tableoutput"); await queueClient.SendAsync(new Message(body)); await marker.Assert(); }
public async Task RespondToEnqueuedItemWithSessionId() { MarkerMessage marker = new MarkerMessage { MarkerId = Guid.NewGuid() }; string json = JsonConvert.SerializeObject(marker); byte[] body = Encoding.UTF8.GetBytes(json); IQueueClient queueClient = new QueueClient(Settings.ServiceBusConnectionString, "sessionidtestqueue"); await queueClient.SendAsync(new Message(body) { SessionId = Guid.NewGuid().ToString() }); await marker.Assert(); }
public async Task RespondToEnqueuedItem() { MarkerMessage marker = new MarkerMessage { MarkerId = Guid.NewGuid() }; string json = JsonConvert.SerializeObject(marker); byte[] body = Encoding.UTF8.GetBytes(json); ITopicClient topicClient = new TopicClient(Settings.ServiceBusConnectionString, "testtopic"); await topicClient.SendAsync(new Message(body)); await marker.Assert(); }
public async Task WriteToStorageQueueWhenResponseIsCollection() { MarkerMessage marker = new MarkerMessage { MarkerId = Guid.NewGuid() }; HttpResponseMessage response = await Settings.Host .AppendPathSegment("outputBindings") .AppendPathSegment("collectionToStorageQueue") .SetQueryParam("markerId", marker.MarkerId) .GetAsync(); Assert.Equal(HttpStatusCode.NoContent, response.StatusCode); await marker.Assert(); }
public async Task WriteToServiceBusTopicWhenResponseIsSingular() { MarkerMessage marker = new MarkerMessage { MarkerId = Guid.NewGuid() }; HttpResponseMessage response = await Settings.Host .AppendPathSegment("outputBindings") .AppendPathSegment("toServiceBusTopic") .SetQueryParam("markerId", marker.MarkerId) .GetAsync(); Assert.Equal(HttpStatusCode.NoContent, response.StatusCode); await marker.Assert(); }
public async Task RespondToUploadedBlob() { var marker = new MarkerMessage { MarkerId = Guid.NewGuid() }; string json = JsonConvert.SerializeObject(marker); CloudBlobClient blobClient = StorageAccount.CreateCloudBlobClient(); CloudBlobContainer container = blobClient.GetContainerReference("streamblobcommands"); CloudBlockBlob blob = container.GetBlockBlobReference($"{marker.MarkerId}.json"); await blob.UploadTextAsync(json); await marker.Assert(); }
public async Task OutputToTableBinding() { var marker = new MarkerMessage { MarkerId = Guid.NewGuid() }; string json = JsonConvert.SerializeObject(marker); CloudBlobClient blobClient = StorageAccount.CreateCloudBlobClient(); CloudBlobContainer container = blobClient.GetContainerReference("outputbindingcontainer"); CloudBlockBlob blob = container.GetBlockBlobReference($"{marker.MarkerId}.json"); await blob.UploadTextAsync(json); await marker.Assert(); }
public async Task WriteToServiceBusQueueWhenResponseIsSingularAndOutputConverterRuns() { MarkerMessage marker = new MarkerMessage { MarkerId = Guid.NewGuid() }; HttpResponseMessage response = await Settings.Host .AppendPathSegment("outputBindings") .AppendPathSegment("toServiceBusQueueWithConverter") .SetQueryParam("markerId", marker.MarkerId) .SetQueryParam("value", 42) .GetAsync(); Assert.Equal(HttpStatusCode.NoContent, response.StatusCode); marker.Value++; // the converter adds 1 to the value await marker.Assert(); }
public async Task RespondToEnqueuedItem() { MarkerMessage marker = new MarkerMessage { MarkerId = Guid.NewGuid() }; string json = JsonConvert.SerializeObject(marker); EventHubsConnectionStringBuilder connectionStringBuilder = new EventHubsConnectionStringBuilder(Settings.EventHubConnectionString) { EntityPath = "maintesthub" }; EventHubClient client = EventHubClient.CreateFromConnectionString(connectionStringBuilder.ToString()); await client.SendAsync(new EventData(Encoding.UTF8.GetBytes(json))); await marker.Assert(); }
public async Task OutputToTableBinding() { string cosmosConnectionString = Settings.CosmosConnectionString; string[] cosmosConnectionStringParts = cosmosConnectionString.Split(';'); string cosmosEndpoint = cosmosConnectionStringParts[0].Substring("AccountEndpoint=".Length); string cosmosAuthKey = cosmosConnectionStringParts[1].Substring("AccountKey=".Length).TrimEnd(';'); using (DocumentClient documentClient = new DocumentClient(new Uri(cosmosEndpoint), cosmosAuthKey)) { MarkerMessage marker = new MarkerMessage { MarkerId = Guid.NewGuid() }; await documentClient.CreateDocumentAsync(UriFactory.CreateDocumentCollectionUri("testdatabase", "outputtablecollection"), marker); await marker.Assert(); } }