Skip to content

Instantly share code, notes, and snippets.

@jvandertil
Created December 31, 2013 17:02
Show Gist options
  • Save jvandertil/8199584 to your computer and use it in GitHub Desktop.
Save jvandertil/8199584 to your computer and use it in GitHub Desktop.
Integration testing with FubuMVC and Katana This did not work.
// 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
}
}
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