NUnit’s new Action Attributes is AOP to your unit tests

With the new NUnit release (v2.6) introduce a new feature called Action Attributes which means that now NUnit has rolled out it’s own mini-AOP capabilities. In the past SetUp and TearDown where used to perform actions before and/or after a test run, they worked well enough but were limited to running certain operation only on … Continue reading NUnit’s new Action Attributes is AOP to your unit tests

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