Category Archives: NUnit

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