Integration testing with the ServiceStack C# client
In this recipe, we'll look at one option for integration testing with ServiceStack. In this case, we'll use a specific approach to integration testing where we develop a separate AppHost
Class for the purpose of testing. It's worth pointing out that this approach shouldn't be thought of as an end-to-end test as it doesn't make any guarantees about what will happen when the code is integrated with AppHost
, and it also doesn't use the same database software as the production service does.
While there are several approaches you can take to test your ServiceStack app, this approach allows the developer to test validation code, request-and-response filters, and other techniques that change the way ServiceStack will handle HTTP requests and responses that BasicAppHost
won't, as they would require actual HTTP communication.
Getting ready
First, we need some services to test. Let's make use of the PlaceToVisit
application from previous recipes. We...