The last month has been a busy one for SpecsFor. I’ve added numerous new features to accommodate additional testing styles and to simplify testing challenges. I’ve also been hard at work on a real site and some docs for SpecsFor. I’m pleased to announce that SpecsFor.com is now live. I’ve also shipped a new version of SpecsFor that simplifies the painful task of creating multiple mocks of the same type for injection into IEnumerable parameters.
SpecsFor.com is still a work-in-progress, but I’m pleased with how it’s shaping up. Thanks to the awesome platform that is AppHarbor and a free template from TemplateMonster, the site is actually snappy and not-completely-unattractive. There are numerous examples showing off the various testing styles SpecsFor supports as well as some of the helpers it provides. I’ve also started on a Frequently Asked Questions section. If you spot something missing or if you have something you’d like to contribute, please let me know!
What’s New In SpecsFor 2.2
The main new feature in SpecsFor 2.2. is the GetMockForEnumerableOf<T> method. Prior to 2.2, it was quite painful to setup and inject multiple mocks of the same type. This scenario comes up frequently when you have a class that consumes all available implementers of some interface. Starting with 2.2, it’s now quite simple to handle these scenarios:
Do note that you must call GetMockForEnumerableOf<T> in the ConfigureContainer method. This will configure the underlying auto-mocking container with the instances so that they can be injected when your class-under-test is created.
There have been several other enhancements I haven’t mentioned since the 2.0 release, including several bugfixes and support for classes that implement IDisposable.
I’m pretty happy with where SpecsFor is at the moment. I plan to create some additional videos to show off what it can do, and I still need to expand the documentation around the various extensibility points that SpecsFor exposes. I’m still very open to feature requests though, so feel free to submit an issue on Github if you run into any testing problems that SpecsFor can’t help you solve.
Aside from that, my focus will be shifting to SpecsFor.Mvc. Look for numerous updates on that front very soon.