developwithpassion.specifications is a formalization of some test utilities that I have been using for the last couple of years. It is written as a thin extension layer on top of the following 2 fantastic libraries:
With the help of Machine.Fakes it currently can be used to do interaction based testing with the following faking libraries:
- FakeItEasy
- Moq
- Rhino.Mocks
- NSubstitute
Thanks to the Machine teams and Bjorn Rochel for the contributions that this library heavily leverages.
- Get a github account
- Login to github
- Fork the main repository
- Push changes to your fork
- Send me a pull request
- Make sure you have the .Net Framework 4.0 installed on your machine.
Clone the repository from github and run the following command at a command prompt:
- build.cmd dist:zip
If the build does not work, please submit an issue through a pull request. After a succesful build you will find all of the zip files under the distribution/zips folder. Currently only 5 of the zip files created are important:
- developwithpassion.specifications.zip - Contains the core library
- developwithpassion.specifications.rhinomocks.zip - Contains the adapters for Machine.Fakes.RhinoMocks
- developwithpassion.specifications.fakeiteasy.zip - Contains the adapters for Machine.Fakes.FakeItEasy
- developwithpassion.specifications.nsubstitute.zip - Contains the adapters for Machine.Fakes.NSubstitute
- developwithpassion.specifications.moq.zip - Contains the adapters for Machine.Fakes.Moq
Installing with NuGet is a snap. There are currently 4 packages available on NuGet (one for each of the Machine.Fakes adapter libraries). To use with Rhino.Mocks for example, just launch the package manager console and type:
- install-package developwithpassion.specifications.rhinomocks
This will install all of the necessary dependencies for the library. The other packages that you could choose are:
- developwithpassion.specifications.fakeiteasy
- developwithpassion.specifications.moq
- developwithpassion.specifications.nsubstitute
The core of the functionality in developwithpassion.specifications can be accessed by deriving your test classes from one of the following 3 classes:
- Observes
- Observes< ClassToTest >
- Observes< Contract , Class >
The last 2 classes provide access to automatic creation of the system under test.
The developwithpassion.specifications.examples project contains many examples of how to use different features of the library. Feel free to contribute other examples as you see fit.