Created
February 2, 2013 15:48
-
-
Save jmarnold/4697920 to your computer and use it in GitHub Desktop.
Sample integration testing
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
[TestFixture] | |
public class IntegrationTestExample | |
{ | |
// You'll want the FubuMVC.Katana package for this | |
private EmbeddedFubuMvcServer theServer; | |
[SetUp] | |
public void SetUp() | |
{ | |
theServer = new MyApplication().RunEmbedded(); | |
} | |
[TearDown] | |
public void Teardown() | |
{ | |
theServer.Dispose(); | |
} | |
[Test] | |
public void do_something() | |
{ | |
var input = new SomeInputModel { value = "test" }; | |
var response = theServer.Endpoints.PostJson(input); | |
response.ReadAsText().ShouldEqual("Hello"); | |
} | |
} |
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() | |
{ | |
return FubuApplication | |
.For<MyFubuMvcPolicies>() | |
.StructureMap(new Container()); | |
} | |
} |
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 MyFubuPolicies : FubuRegistry | |
{ | |
public MyFubuPolicies() | |
{ | |
// This is a DSL to change or add new conventions, policies, or application settings | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For future reference: https://groups.google.com/forum/#!topic/fubumvc-devel/b0ATWphEBUs