Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Created July 19, 2017 13:48
Embed
What would you like to do?
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