Skip to content

Month: February 2019

NUnit test cases

Testing multiple scenarios through the same function can be a bit of a time sink. Writing out a method for each scenario and just changing the data passed into the function then checking the output against the expected result. Steve Fenton showed me NUnit test cases the other day though which make running multiple permutations of data against a result set a breeze! They have been around a while I think, but I somehow missed that boat. See below for a simple example of how they work. The test above will check multiple combinations of inputs against the expected output…

Refactoring – Flocking rules

I have always been a fan of Sandi Metz, and have finally got around to her book 99 Bottles of OOP. A key takeaway so far from this has been the flocking rules for refactoring. The name derives from the small changes an individual bird makes in a flock that is then reflected by all the other birds so everyone ends up going in the right direction. The premise is fairly simple, make small incremental changes that only change a single thing a time. A lot of people think they do this already, however small is not small enough in…