コード例 #1
0
        public async Task GraphRefreshSocHttpTriggerRunFunctionReturnsBadRequestForPublishedEnvironment()
        {
            // Arrange
            const HttpStatusCode expectedResult = HttpStatusCode.BadRequest;
            var graphRefreshSocHttpTrigger      = new GraphRefreshSocHttpTrigger(fakeLogger, publishedEnvironmentValues);

            // Act
            var result = await graphRefreshSocHttpTrigger.Run(null, 3231, Guid.NewGuid(), fakeDurableOrchestrationClient).ConfigureAwait(false);

            // Assert
            A.CallTo(() => fakeDurableOrchestrationClient.StartNewAsync(A <string> .Ignored, A <SocRequestModel> .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);
        }
コード例 #2
0
        public async Task GraphRefreshSocHttpTriggertReturnsUnprocessableEntityWhenStartNewAsyncRaisesException()
        {
            // Arrange
            const HttpStatusCode expectedResult = HttpStatusCode.InternalServerError;
            var graphRefreshSocHttpTrigger      = new GraphRefreshSocHttpTrigger(fakeLogger, draftEnvironmentValues);

            A.CallTo(() => fakeDurableOrchestrationClient.StartNewAsync(A <string> .Ignored, A <SocRequestModel> .Ignored)).Throws <Exception>();

            // Act
            var result = await graphRefreshSocHttpTrigger.Run(null, 3231, Guid.NewGuid(), fakeDurableOrchestrationClient).ConfigureAwait(false);

            // Assert
            A.CallTo(() => fakeDurableOrchestrationClient.StartNewAsync(A <string> .Ignored, A <SocRequestModel> .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);
        }