Skip to content

Instantly share code, notes, and snippets.

@ungood
Created August 30, 2012 17:31
Show Gist options
  • Save ungood/3534468 to your computer and use it in GitHub Desktop.
Save ungood/3534468 to your computer and use it in GitHub Desktop.
Simple Console App example
public class Program
{
public static void Main()
{
// Register
using(var kernel = ConfigureKernel())
{
// Resolve
var program = kernel.Get<Program>();
program.Run();
} // Release
}
private static IKernel ConfigureKernel()
{
return new StandardKernel(
new SomeModule1(),
new SomeModeul2());
}
public Program(ISomeDependency1 foo, ISomeDependency2 bar)
{
this.foo = foo;
this.bar = bar;
}
public void Run()
{
// Do stuff - this stuff is now unit testable, as you can inject mocks into Program ctor.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment