public async Task GraphRefreshHttpTriggerRunFunctionReturnsBadRequestForPublishedEnvironment() { // Arrange const HttpStatusCode expectedResult = HttpStatusCode.BadRequest; var graphRefreshHttpTrigger = new GraphRefreshHttpTrigger(fakeLogger, publishedEnvironmentValues); // Act var result = await graphRefreshHttpTrigger.Run(null, fakeDurableOrchestrationClient).ConfigureAwait(false); // Assert A.CallTo(() => fakeDurableOrchestrationClient.StartNewAsync(A <string> .Ignored, A <OrchestratorRequestModel> .Ignored)).MustNotHaveHappened(); A.CallTo(() => fakeDurableOrchestrationClient.CreateCheckStatusResponse(A <HttpRequest> .Ignored, A <string> .Ignored, A <bool> .Ignored)).MustNotHaveHappened(); var statusResult = Assert.IsType <BadRequestResult>(result); Assert.Equal((int)expectedResult, statusResult.StatusCode); }
public async Task GraphRefreshHttpTriggerReturnsUnprocessableEntityWhenStartNewAsyncRaisesException() { // Arrange const HttpStatusCode expectedResult = HttpStatusCode.InternalServerError; var graphRefreshHttpTrigger = new GraphRefreshHttpTrigger(fakeLogger, draftEnvironmentValues); A.CallTo(() => fakeDurableOrchestrationClient.StartNewAsync(A <string> .Ignored, A <OrchestratorRequestModel> .Ignored)).Throws <Exception>(); // Act var result = await graphRefreshHttpTrigger.Run(null, fakeDurableOrchestrationClient).ConfigureAwait(false); // Assert A.CallTo(() => fakeDurableOrchestrationClient.StartNewAsync(A <string> .Ignored, A <OrchestratorRequestModel> .Ignored)).MustHaveHappenedOnceExactly(); A.CallTo(() => fakeDurableOrchestrationClient.CreateCheckStatusResponse(A <HttpRequest> .Ignored, A <string> .Ignored, A <bool> .Ignored)).MustNotHaveHappened(); var statusResult = Assert.IsType <StatusCodeResult>(result); Assert.Equal((int)expectedResult, statusResult.StatusCode); }