Category Archives: TDD

VS2012 ‘Cannot launch debugger’ error when trying to debug tests

If you’re using Visual Studio 2012 with ReSharper on a 64-bit version of Windows and get these messages when trying to debug a test, this is a known issue with Microsoft VS2012  and not ReSharper (so don’t go blaming the … Continue reading

Posted in ReSharper, TDD, VS2012

TDD and the Red-Green-Refactor approach

We’re all familiar with the term test-driven development now, but it seems a lot of developers still aren’t using it in their normal daily routine. TDD has been in circulation since 2003 or earlier, and has probably been mainstream since … Continue reading

Posted in Agile, TDD

Unit-testing Asynchronous Events

Once in the realm of asynchronous calls, we have no guarantee of which thread or precisely when an event handler might be called, which makes testing asynchronous events that much more difficult. As a result it makes the test shown … Continue reading

Posted in C#, Multi-threading, NUnit, TDD | Leave a comment

Unit-testing Synchronous Events

It’s easy to forget (or choose not to) test events when you’re writing test-driven code, but they mustn’t be ignored because client code which subscribes to your events will depend on them firing under the correct circumstances. And without tests … Continue reading

Posted in C#, NUnit, TDD | Leave a comment

Unit-testing ASP.NET MVC ViewModel validation

One of the biggest advantages ASP.NET MVC has over ASP.NET Web Forms is the ability to unit-test your views (UI), controllers (HTTP request handlers) and view models (data) easily thanks to the separation of concerns that the MVC pattern gives … Continue reading

Posted in ASP.NET MVC, NUnit, TDD | 3 Comments

A generic XML string serialiser

The following class is a simple XML string serialiser which will work with most .NET objects except WCF data contracts which require the NetDataContractSerializer. The static methods Serialise and Deserialise convert an object instance to an XML string and vice … Continue reading

Posted in C#, NUnit, TDD | Leave a comment