Another pattern? Well yes. I write unit and integration tests almost every day and along the way i learned all kinds of different tricks and gotchas on how to be more productive and how to write less fragile tests. But one of the patterns that emerged i never saw in the code of other people so i decided to share it here since i find it very useful. I call it Testing Context Pattern and – unlike it’s name – its very simple. Idea is to create in your Test Fixture a private class called (you guessed it) TestContext and put Read More
In all my previous MVVM in Silverlight 4 posts i was avoiding to address one painful aspect of the Silverlight: calling WCF Web Services. And it was not without reason. Lets face it, consuming WCF Web Services from your Silverlight application can be pretty hard. I mean hard to do it in a clean way off course. Yes we all know how to create a Silverlight enabled WCF Web Service from Visual Studio but things become messy from that point. First question is how to invoke methods of the web service? Should we use Add Web Service Reference from the Visual Read More
Im not the kind of purist that will avoid unit testing internal classes. If its some very important code i want to test it even if its internal.
Another case when i want to access internal classes is when i want to test some public class that uses some internal classes (via their interfaces).
In this scenario i need to be able to mock those internal interfaces that the public class is using in order to be able to instantiate it and unit test it.