Testing.Commons goes 1.0

Let’s throw a party!

A Big Gap

Wait a second? Last release was, when stuff to test the profile system was added. “Either you have been terribly busy or you are tricking us.

Well, more of the latter if you check the amount of code of the deltas committed. In reality my plan was to go 1.0 when all the code I previously had was ported. It turned out to be less than I thought as I trimmed out some parts I cannot use and clipped redundancies.

What’s in?

Besides the already mentioned in my previous ranting-entry CultureReseter, that allows scoped fine grained control over the culture of the thread, the bulk comes in the shape of helpers to ease testing web elements.

ControlLifeCyle allows calling protected method to simulate the life-cycle of a custom control and HttpContextBuilder eases the creation of the “800 lb gorilla” that HttpContext is.


It may sound like a small thing, but the coolest feature of the class is being able to infer the name of the protected method from a strongly-typed event name.
I cannot tell you how many times I have fought the war of C# syntax clumsiness for events. This time I spent more time and won it just by chance. change is because I found the solution while googling late in the evening for something else.
All the Expression code I have spiked and how many times I have looked Rhino-Mocks’ proxy based codebase (not the simplest codebase to grasp I have to say) in search of a way that allows me to get the name of an event using strongly-typed reflection will not see the light. The secret was MSIL parsing. But of course!

The inspiration came from a blog about Castle.Windsor facilities, which made me look into their facilities for event wiring, dig into their source code and pick the pieces that I needed, and re-organize them for my purposes. Don’t we love OSS software?


Yes, this one is got external inspiration: here and here. But Phil Haack’s reflective-heavy approach was making my tests fail and Jason Bock’s was felt aged and feature-short. So I merged the ideas from both, fluently lifted its API and voilà, one can create feature rich instances of the big guy.

Where you said?

I knew it, Testing.Commons is exactly what you were looking for! Go and get it from the project site or NuGet.

What now?

I told you I finished importing the bulk of my previously created code. That means that, unless people contribute we are going to see a slow down in the rate of releases.

That is not sad in itself, because it means that Testing.Commons.NUnit is ready to take-off!

Daniel Gonzalez Garcia
Vertica A/S

Categories: Udvikling

Tagged as: , ,

Skriv et svar