Пример #1
0
        public async Task GraphPurgeSocHttpTriggerRunFunctionReturnsBadRequestForPublishedEnvironment()
        {
            // Arrange
            const HttpStatusCode expectedResult = HttpStatusCode.BadRequest;
            var graphPurgeSocHttpTrigger        = new GraphPurgeSocHttpTrigger(fakeLogger, publishedEnvironmentValues);

            // Act
            var result = await graphPurgeSocHttpTrigger.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 GraphPurgeSocHttpTriggerReturnsUnprocessableEntityWhenStartNewAsyncRaisesException()
        {
            // Arrange
            const HttpStatusCode expectedResult = HttpStatusCode.InternalServerError;
            var graphPurgeSocHttpTrigger        = new GraphPurgeSocHttpTrigger(fakeLogger, draftEnvironmentValues);

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

            // Act
            var result = await graphPurgeSocHttpTrigger.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);
        }