Hi Episerver developers!
I have updated FakeMaker (helping you unit test your Episerver code) to support the version 9 binaries. Breaking changes caused compile errors (oops!) and made the tool incompatible with the latest versions of Episerver. It turns out that the base library context no longer has to be mocked, and that's a good thing! The solution was simple: delete code. I love deleting code, maybe even more than writing code.
FakeMaker may help you delete your code.
When writing unit tests, creating fake content and mocked repositories can be a bit depressing. When mocked code is all you see on your screen, this little library may help. A bigger screen probably also would, but is probably more expensive (and won't cure depression).
The latest version is available for download on NuGet, and the source code is on GitHub. Both are targeting version 9.6.1 of the Episerver Core libraries.
If you need Episerver 8 support, download an earlier version from NuGet, or clone the GitHub repo and checkout the epi-8-support branch.
Please let me know if you have feature requests or run into any issues.
Here's an example of what you can do with FakeMaker:
you are about to write code that uses the episerver page tree to find pages of a certain type, children of a root node, or maybe just the start page. FakeMaker makes easier to write unit tests for code like that, by creating an in memory page tree and add it to a fake content repository.
Create the pages you need:
var page = FakePage.Create("MyPageName");
or a page of a specific page type:
var myCustomPage = FakePage.Create<CustomPageData>("MyOtherPageName");
Create an instance of FakeMaker:
var fake = new FakeMaker();
Add it to the mocked repository:
Want more examples?
You will find more examples at the FakeMaker GitHub repo.