Category Archives: NUnit

AutoMapper Tests Made Simple

I work primarily on a C# ASP.NET MVC application that deals with many other systems which seem to dish out strings all over the place. Hence the need for something like AutoMapper. When converting this data into objects or enumerations, … Continue reading 

Also posted in AutoMapper, DRY, Testing | Leave a comment

Unit Testing [Serializable]

A common struggle with unit testing is figuring when to just assume somebody else’s code works. One such example is serializability: for simple classes, it should “just work” so we shouldn’t need to write a unit test for each of … Continue reading 

Also posted in IowaCodeCamp, Members | Leave a comment

Review: Pragmatic Unit Testing In C# with NUnit (2nd Edition)

I’ve written hundreds of tests, read dozens of articles and listened to several presentations on unit testing, but until recently had never actually read a book dedicated to the subject. In reviewing my options, I was told repeatedly that I … Continue reading 

Also posted in Uncategorized | 1 Comment

Working With Assertions Made on Arguments in Rhino Mocks

  Today when modifying what we call an “order notifier” (essentially observers that are notified when an order is placed), I was having trouble figuring out why my test was failing. The project is written in C# and this test … Continue reading 

Also posted in Best Practices, RhinoMocks, Testing | 7 Comments

Why is CruiseControl.Net Hiding My Test Results?

Some time ago, I noticed a CruiseControl.Net build report with thousands of unit tests passed, zero failed and a dozen or so skipped, suddenly showing that no tests were run: I immediately thought somebody did something really bad. After some … Continue reading 

Also posted in Continuous Integration, Testing | 1 Comment

Unit Testing Simple ASP.NET MVC Controllers

I have created enough simple projects using ASP.NET MVC with unit tests to notice a very helpful pattern. The following is a sample of a test fixture using RhinoMocks and NUnit to test a controller. 1: [TestFixture] 2: public class … Continue reading 

Also posted in ASP.NET MVC, Development, DRY, Moq, RhinoMocks | 6 Comments