public async Task GetReturnsSuccessWhenDataPresent() { // Arrange var expectedResult = new OkResult(); var function = new PagesDataLoadHttpTrigger(fakeLogger, fakePagesDataLoadService); A.CallTo(() => fakePagesDataLoadService.LoadAsync()); // Act var result = await function.Run(A.Fake <HttpRequest>()).ConfigureAwait(false); // Assert A.CallTo(() => fakePagesDataLoadService.LoadAsync()).MustHaveHappenedOnceExactly(); var statusResult = Assert.IsType <OkResult>(result); Assert.Equal(expectedResult.StatusCode, statusResult.StatusCode); }
public async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "pages/")] HttpRequest request) { logger.LogInformation("Loading all pages data into app registrations"); await pagesDataLoadService.LoadAsync().ConfigureAwait(false); logger.LogInformation("Loaded all pages data into app registrations"); return(new OkResult()); }