How to return default(Type) in runtime – a TDD example in four unit tests

I’ve found this question while going over my old StackOverflow answers:I'm using reflection to loop through a Type's properties and set certain types to their default. Now, I could do a switch on the type and set the default(Type) explicitly, but I'd rather do it in one line. Is there a programmatic equivalent of default?I … Continue reading How to return default(Type) in runtime – a TDD example in four unit tests

Find out where is the method that was called unexpectedly using fake objects

Every Isolation/Mocking framework out there can verify that a method of a fake object was called and not less important make sure that certain methods are not called. Let’s say that I want to make sure that a method didn’t encounter any errors during execution but verifying that logger.Error was not called: [TestFixture]public class MyClassTests{ … Continue reading Find out where is the method that was called unexpectedly using fake objects

How to run your unit tests as part of TFS build

Writing unit tests is good, having a build server that run the unit test on each commit/check-in is great!   In the past I’ve used TeamCity and FinalBuilder to administer my builds and run my tests, it was easy and painless and it worked. Unfortunately we cannot always decide our organization build strategy and if … Continue reading How to run your unit tests as part of TFS build

How to run NUnit tests created with VS2010 and .NET 4

Today when writing tests for a new project built using VS2010 I had an interesting problem: NUnit would not run my unit tests because the assembly that contained my unit tests was compiled using a newer version of the .NET runtime. There are several solutions to solve this issue from downgrading my project to use … Continue reading How to run NUnit tests created with VS2010 and .NET 4

#Nose – the unit test discovery tool

One of the benefits of programming in C#/VB.NET is amount of tools available - from Visual Studio to build servers to unit testing frameworks it seems that there is a tool for every job. I thought that my .NET tool belt has everything I need until recently, while learning Python (actually IronPython) I’ve discovered Python-Nose … Continue reading #Nose – the unit test discovery tool