New Pluralsight course: Advanced C++ Mocking Using Google Mock

My latest course: Advanced C++ Mocking Using Google Mock was published during the weekend. After finishing my very first Pluralsight course I knew I want to author another one. I've been working with C++, Java and .NET developers for the last five years, teaching about clean code, design patterns and unit testing. I've seen good developers struggle with TDD, … Continue reading New Pluralsight course: Advanced C++ Mocking Using Google Mock

Faking DateTime using Microsoft Fakes seems to be broken

It seems as if causing DateTime.Now to return another value has become the demo to show when demoing an unconstrained Mocking framework. It’s easy to show and needed in many unit tests – unless you want your tests to be affected by time – trust me and you don’t. That’s why I was amazed to … Continue reading Faking DateTime using Microsoft Fakes seems to be broken

How to fake a singleton in C++

When unit testing legacy code I find several (anti) patterns which prevent getting code under test. The most recurring pattern I see is the Singleton pattern – a useful pattern when not abused and overused.In the object oriented world Singleton’s are slightly better than their evil cousin – the static method. Unfortunately I’ve seen them … Continue reading How to fake a singleton in C++

Using NUnit and FakeItEasy to create fake objects automatically for your tests

From time to time I get to teach and mentor Java developers on the fine art of unit testing. There are many similarities when unit testing in Java and .NET but more interesting are the differences between the two. Faking objects in Java using MockitoOne of the well-used Java Isolation (Mocking) frameworks is called Mockito … Continue reading Using NUnit and FakeItEasy to create fake objects automatically for your tests

What to do when FakeItEasy throws System.BadImageException

Today I had a weird problem at work. I’ve been working with a new team and they’ve been writing unit tests using FakeItEasy when they got a strange error message:System.BadImageFormatException: … The signature is incorrect.Now I’ve been using FakeItEasy for some time and I never once saw this strange behavior. Googling for the problem only … Continue reading What to do when FakeItEasy throws System.BadImageException