public async Task CreateCheckStatusResponse_Returns_Corrent_HTTP_202_Response() { var httpApiHandler = new HttpApiHandler(new DurableTaskExtension() { NotificationUrl = new Uri(TestConstants.NotificationUrl) }, null); var httpResponseMessage = httpApiHandler.CreateCheckStatusResponse( new HttpRequestMessage { RequestUri = new Uri(TestConstants.RequestUri), }, TestConstants.InstanceId, new OrchestrationClientAttribute { TaskHub = TestConstants.TaskHub, ConnectionName = TestConstants.ConnectionName, }); Assert.Equal(HttpStatusCode.Accepted, httpResponseMessage.StatusCode); var content = await httpResponseMessage.Content.ReadAsStringAsync(); var status = JsonConvert.DeserializeObject <JObject>(content); Assert.Equal(status["id"], TestConstants.InstanceId); Assert.Equal( "http://localhost:7071/admin/extensions/DurableTaskExtension/instances/7b59154ae666471993659902ed0ba742?taskHub=SampleHubVS&connection=Storage&code=mykey", status["statusQueryGetUri"]); Assert.Equal( "http://localhost:7071/admin/extensions/DurableTaskExtension/instances/7b59154ae666471993659902ed0ba742/raiseEvent/{eventName}?taskHub=SampleHubVS&connection=Storage&code=mykey", status["sendEventPostUri"]); Assert.Equal( "http://localhost:7071/admin/extensions/DurableTaskExtension/instances/7b59154ae666471993659902ed0ba742/terminate?reason={text}&taskHub=SampleHubVS&connection=Storage&code=mykey", status["terminatePostUri"]); }
private void CreateCheckStatusResponse_Throws_Exception_When_NotificationUrl_Missing() { var httpApiHandler = new HttpApiHandler(new DurableTaskExtension(), null); var ex = Assert.Throws <InvalidOperationException>(() => httpApiHandler.CreateCheckStatusResponse(new HttpRequestMessage(), string.Empty, null)); Assert.Equal("Webhooks are not configured", ex.Message); }