Created
December 31, 2013 17:02
-
-
Save jvandertil/8199584 to your computer and use it in GitHub Desktop.
Integration testing with FubuMVC and Katana This did not work.
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
// Using a separate class for bootstrapping makes it much easier to reuse your application | |
// in testing scenarios with either SelfHost or OWIN/Katana hosting | |
public class MyApplication : IApplicationSource | |
{ | |
public FubuApplication BuildApplication() | |
{ | |
// This is bootstrapping an application with all default FubuMVC conventions and | |
// policies pulling actions from only this assembly for classes suffixed with | |
// "Endpoint" or "Endpoints" | |
return FubuApplication.DefaultPolicies().StructureMap<MyStructureMapRegistry>(); | |
// Fancier way if you want to specify your own policies: | |
// return FubuApplication.For<MyFubuMvcPolicies>().StructureMap(new Container()); | |
// Here's an example of using StructureMap specific registration with a StructureMap Registry. | |
// return FubuApplication.For<MyFubuMvcPolicies>().StructureMap<MyStructureMapRegistry>(); | |
} | |
} | |
public class MyStructureMapRegistry : Registry | |
{ | |
public MyStructureMapRegistry() | |
{ | |
// StructureMap registration here | |
} | |
} | |
public class MyFubuMvcPolicies : FubuRegistry | |
{ | |
public MyFubuMvcPolicies() | |
{ | |
//this.Import<KatanaExtensions>(); // This was me, testing. Did not work either. | |
// This is a DSL to change or add new conventions, policies, or application settings | |
} | |
} |
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 Class1 | |
{ | |
private EmbeddedFubuMvcServer _server; | |
[SetUp] | |
public void Setup() | |
{ | |
_server = new MyApplication().BuildApplication().RunEmbedded(); | |
} | |
[TearDown] | |
public void TearDown() | |
{ | |
_server.Dispose(); | |
} | |
[Test] | |
public void test() | |
{ | |
var result = _server.Endpoints.GetByInput(new HomeModel()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment