Archive for the ‘Unit Testing’ Category


Unit Testing Internal methods.

July 10, 2008

Today I did some pair programming with Richard Banks from Readify.

When I explained to him that I use the IDE to generate these property accessors that use reflection to test internal and private methods he showed me a nicer way around it:

Basically all I had to do was [assembly: InternalsVisibleTo(“Assembly Name”)] to the assembly.cs file and make sure that the “Assembly Name” was pointing to the unit tests assembly name.

This worked perfectly! Thanks Richard!

P.S I should state the obvious note that this approach doesn’t work for private methods


My day at work…

December 17, 2007

Yesterday at work I did two really cool things.
1) I had a live one note session with my colleague. It was a brain dump on what we should be testing in the project for our stabilization phase. See, as we reach christmas we decided to make the final week of the scrum sprint to be a stablization phase to make sure we weren’t starting off a sprint and leaving it half done over christmas.
I am really pleased with the session we had, it was extremely efficient beacuse we would see what each was writing then and there and would either say ‘Oh yes, good point I didn’t think of that!’ or ‘Hey, there’s no need to test that because I already implemented that fix’ or even ‘That scenario could be tested better by doing this’
This kind of rapid response/feedback I felt was worth a lot of time

2) We then went away and started wiring up the test harnesses. We are using visual stuidio unit tests and currently have no mockery architecture in place. We have about 20 unit tests so far and because they all touch the database it is starting to get slow to run the unit tests. I suspect the need for a mockery unit test solution will show its head shortly.

That’s all folks.