Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Last active August 28, 2017 12:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinyoo/835a482a72f744d0a869531b4f63899b to your computer and use it in GitHub Desktop.
Save justinyoo/835a482a72f744d0a869531b4f63899b to your computer and use it in GitHub Desktop.
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