public async Task PostCdnReturnsSuccessResult()
        {
            // Arrange
            const HttpStatusCode expectedResult = HttpStatusCode.OK;
            var existingAppRegistrations        = BuildExistingAppRegistrations();
            var request = BuildRequestWithModel(new CdnPostModel {
                Cdn = "https://somewhere.com"
            });
            var function = new CdnUpdatePostHttpTrigger(fakeLogger, fakeDocumentService, fakeUpdateScriptHashCodes);

            A.CallTo(() => fakeDocumentService.GetAsync(A <Expression <Func <AppRegistrationModel, bool> > > .Ignored)).Returns(existingAppRegistrations);
            A.CallTo(() => fakeDocumentService.UpsertAsync(A <AppRegistrationModel> .Ignored)).Returns(HttpStatusCode.OK);
            A.CallTo(() => fakeUpdateScriptHashCodes.UpdateAllAsync(A <string> .Ignored)).Returns(HttpStatusCode.OK);

            // Act
            var result = await function.Run(request).ConfigureAwait(false);

            // Assert
            A.CallTo(() => fakeDocumentService.GetAsync(A <Expression <Func <AppRegistrationModel, bool> > > .Ignored)).MustHaveHappenedOnceExactly();
            A.CallTo(() => fakeDocumentService.UpsertAsync(A <AppRegistrationModel> .Ignored)).MustHaveHappenedOnceExactly();
            A.CallTo(() => fakeUpdateScriptHashCodes.UpdateAllAsync(A <string> .Ignored)).MustHaveHappenedOnceExactly();

            var statusResult = Assert.IsType <OkResult>(result);

            Assert.Equal((int)expectedResult, statusResult.StatusCode);
        }
        public async Task PostCdnReturnsBadRequestWhenRequestIsNull()
        {
            // Arrange
            const HttpStatusCode expectedResult = HttpStatusCode.BadRequest;
            var function = new CdnUpdatePostHttpTrigger(fakeLogger, fakeDocumentService, fakeUpdateScriptHashCodes);

            // Act
            var result = await function.Run(null).ConfigureAwait(false);

            // Assert
            A.CallTo(() => fakeDocumentService.GetAsync(A <Expression <Func <AppRegistrationModel, bool> > > .Ignored)).MustNotHaveHappened();
            A.CallTo(() => fakeDocumentService.UpsertAsync(A <AppRegistrationModel> .Ignored)).MustNotHaveHappened();
            A.CallTo(() => fakeUpdateScriptHashCodes.UpdateAllAsync(A <string> .Ignored)).MustNotHaveHappened();

            var statusResult = Assert.IsType <BadRequestResult>(result);

            Assert.Equal((int)expectedResult, statusResult.StatusCode);
        }