Skip to content

Instantly share code, notes, and snippets.

@gasparnagy
Created February 20, 2017 06:46
Show Gist options
  • Save gasparnagy/95d4b644d1aced25bee797cd6fbffc20 to your computer and use it in GitHub Desktop.
Save gasparnagy/95d4b644d1aced25bee797cd6fbffc20 to your computer and use it in GitHub Desktop.
public static class TestDependencies
{
[ScenarioDependencies]
public static ContainerBuilder CreateContainerBuilder()
{
// create container with the runtime dependencies
var builder = Dependencies.CreateContainerBuilder();
//TODO: add customizations, stubs required for testing
//auto-reg all types from our assembly
//builder.RegisterAssemblyTypes(typeof(TestDependencies).Assembly).SingleInstance();
//auto-reg all [Binding] types from our assembly
builder.RegisterTypes(typeof(TestDependencies).Assembly.GetTypes().Where(t => Attribute.IsDefined(t, typeof(BindingAttribute))).ToArray()).SingleInstance();
return builder;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment