public async Task LocationDataLoadReturnsNumberLoaded() { //Setup var expectedNumber = 123; A.CallTo(() => fakeLoadLocations.GetLocationsAndUpdateIndexAsync()).Returns(expectedNumber); var function = new LocationDataLoad(fakeLogger, fakeLoadLocations); //Act var result = await function.Run(new DefaultHttpRequest(new DefaultHttpContext())).ConfigureAwait(false); //Assert A.CallTo(() => fakeLoadLocations.GetLocationsAndUpdateIndexAsync()).MustHaveHappenedOnceExactly(); var okResult = Assert.IsType <OkObjectResult>(result); okResult.StatusCode.Should().Be((int)HttpStatusCode.OK); okResult.Value.ToString().Should().Contain($"Loaded {expectedNumber} Locations"); }
Run([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "loadlocations")] HttpRequest req) { logger.LogInformation($"Starting loaded locations with {req?.Body}"); var numberLoaded = await loadLocations.GetLocationsAndUpdateIndexAsync().ConfigureAwait(false); logger.LogInformation("Completed loaded locations"); return(new OkObjectResult($"Loaded {numberLoaded} Locations")); }