Tutorial for Test Driven Development

Have you ever tried TDD and failed (for several reasons)? Do you wanna give it a try again with a valueable tutorial by your side. Than try out the free ebook of Grzesiek Galezowski:

https://leanpub.com/tdd-ebook/read

This ebook does not only mention basics of TDD but also very important principles of Object-oriented programming (SRP, ISP, Object Composability, How to start writing valueable tests before even start writing productive code, etc.)

Give it a try!

Prism – RegionManager ready for Unit-Tests

You are using Prism for navigation and region management of your application. Be it WPF, Silverligh, Windows Apps, etc.

In any kind of application you will need to work with prism ultimate wappon for navigation and region management – IRegionManager interface.

But how can you test your Modules, ViewModels and any kind of logic which is used to handle navigation or region management. ‚IRegionManager‘ interface is a little bit tricky because many methods are implemented as extension methods. And extension methods can not be mocked by any unit test framework out there.

But there is a pretty simple solution for this problem: ‚Adapter Design Pattern‘. Take a look at a possible solution:

Now all you need to write your unit-tests is to mock ‚IMyRegionManager‘. If you need to mock much more extension methods just add them to YOUR interface and implement an adapter method for the extension method of ‚IRegionManager‘.