NUnit and the Values Attribute

This quick post is a little ditty about NUnit’s Values attribute, and how we can use it to help ensure our tests fully cover desired functionality.   Problem Space Introduced in the 2.5 release as part of NUnit’s new parameterized test support, the Values attribute allows you to quickly up your test count with just [...]

 
NUnit and the new TestContext Class

With release 2.5.7, NUnit has introduced a new TestContext class that can be used to get information about the tests that are running. No immediate applications of this jump out to me right now, but it’s good to know that the functionality is now available with resorting to hack-like approaches. This post is a bare [...]

 
Visual Studio 2010 NUnit Code Snippets

While I’m a big fan of time saving techniques while coding, I’ve come to realize that I’m not a big fan of platform-specific tools that could very well handicap you when moving to another editor/language/platform once you’ve become reliant on the myriad of shortcuts said tool might provide. Visual Studio 2010’s code snippets stay on [...]

 
The Joy of Moq - Partial Mocks

Continuing to extol the virtues of Moq, in this post we will explore how to do partial mocking in situations where we are testing a class that calls one or more of its own methods.   The Class Diagram Below is the mocked (never gets old) up class that we will be testing. public class [...]

 
The Joy of Moq - Multiple Interfaces

A few weeks ago I wrote about how my team has been making the switch to Moq over NMock; since then, we really haven’t looked back. Recently I had cause to use a couple of Moq’s features that reinforced the decision to make the switch: partial mocking, and mocking an object that implements multiple interfaces. [...]

 
NUnit Doh: Setup != TestFixtureSetup

In the continuing trend of realized mistakes this week, we’ll be reviewing another error I made in code earlier this year as it relates to test setup. The title says it all: Setup != TestFixtureSetup.   The Scenario One of our new projects has achieved a high level of coverage that’s been maintained from the [...]

 
A Unit Test You Should Never Write

I was revisiting some code from several months ago and found some tests similar to the below. [Test] public void CanReadAndWriteAllPropertiesTest() { SomeObject so = new SomeObject { SomeIntProperty = 1, SomeStringProperty = “hi”, SomeBoolProperty = false, SomeObjectProperty = new Object() }; Assert.That(so.SomeIntProperty, Is.EqualTo(1)); Assert.That(so.SomeStringProperty, Is.EqualTo(“hi”)); Assert.That(so.SomeBoolProperty, Is.False); Assert.That(so.SomeObjectProperty, Is.Not.Null); } I remembered why I [...]

 
Yet Another .NET Mocking Framework

That’s right, yet another .NET mocking framework. Given that my team is making the transition from NMock to Moq for a variety of reasons, I most definitely wasn’t looking for another such framework. Then I read one of Roy Osherove’s tweets: Pretty compelling statement coming from Roy, and in light of my recent conversion to [...]

© 2011 Musings of the Bare Bones Coder Suffusion theme by Sayontan Sinha