Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Testing Serverless Applications - Part 1
public static class GetArmTemplateDirectoriesHttpTriggerWithServiceLocator
{
// Declare a static IServiceLocator property.
public static IServiceLocator ServiceLocator { get; set; } = new ServiceLocatorBuilder().RegisterModule<AppModule>().Build();
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, ILogger log)
{
// Resolve the service instance through the service locator property.
var service = ServiceLocator.GetInstance<IGitHubService>();
var query = GetQuery(req);
var models = await service.GetArmTemplateDirectoriesAsync(query)
.ConfigureAwait(false);
return req.CreateResponse(HttpStatusCode.OK, models);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment