Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Created July 19, 2017 13:48
Show Gist options
  • Save justinyoo/fd22aac8bb6c477f25314194e65bd741 to your computer and use it in GitHub Desktop.
Save justinyoo/fd22aac8bb6c477f25314194e65bd741 to your computer and use it in GitHub Desktop.
Testing Serverless Applications - Part 1
public class FunctionFactory
{
public FunctionFactory()
: this(null)
{
}
public FunctionFactory(RegistrationHandler handler = null)
{
this.ServiceLocator = new ServiceLocatorBuilder().RegisterModule<AppModule>(handler).Build();
}
public virtual IServiceLocator ServiceLocator { get; set; }
public virtual TFunction Create<TFunction>(ILogger log)
where TFunction : IFunction
{
var function = this.ServiceLocator.GetInstance<TFunction>();
function.Log = log;
function.ServiceLocator = this.ServiceLocator;
return function;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment