Integrating NUnit
The next step is to integrate a testing framework. We'll make use of the NUnit library in the examples in this book, though ServiceStack does work with almost any testing framework. First, add a new project to our solution. Call it <SolutionName>.Tests
, substituting in the name of the package that you will test. Choose Class Library as the type. In Package Manager Console, choose <SolutionName>.Tests
from the Default Project dropdown, and then type Install-Package nunit
. You'll need to add a reference to ServiceStack from the test project as well—you can do that by typing Install-Package servicestack
in Package Manager Console, as you did previously.
Now that you have a test project, you can start adding test classes. Generally, the idea is to create a test class for each grouping of tests—often, this means one test class per object under test. Create a new class inside your test project, then place the annotation [TestFixture]
above...