Probably you already know it: The new Windows Store App class libraries prevent proxy generating using frameworks like Castle.Core because System.Reflection.Emit namespace is missing in the limited framework they’re using.
But we still want to do TDD and therefore we need a nice mocking framework, like FakeItEasy, don’t we?
In this blog post I will show you the best way I came up with to develop Windows Store App compatible code with TDD.
So, how should you setup your project?
- Put all your productive code that will be TDD-ed into a PCL class library where you select whatever target frameworks you like to support
- Create your test assembly as a regular class library
- Add the references to FakeItEasy and your test framework(s) of choice (e.g. NUnit + FluentAssertions) to your *.Test assembly
- Only put the UI stuff that you can’t test into a Windows Store App project
Your solution explorer should look similar to mine
You’re ready to go. Happy TDDing with Windows Store Apps and FakeItEasy.
Yes, that is not the perfect solution. But at least it is a solution that works.