Created
August 30, 2012 17:31
-
-
Save ungood/3534468 to your computer and use it in GitHub Desktop.
Simple Console App example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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