One step past Assert.Throws<>

If you’re not using xUnit (and you should be), at least consider adopting the practices they have for dealing with exceptions in unit tests. From the very first release, they moved us from this:[ExpectedException(typeof(InvalidOperationException))] public void WithdrawingMoreThanBalanceThrows() {     Account account = new Account();     account.Deposit(100);     account.Widthraw(200); } to the far-better: public void WithdrawingMoreThanBalanceThrows()…

2

Can you take the single responsibility principle too far?

This morning, I had a conversation with a colleague of mine who has recently started using EDD about “exposing things just for the purpose of testing.” Although I have run across the odd occasion where I may need to add a get property to a class in order to verify a value, usually I find…

6

xUnit.net goes live!

NUnit is dead! Long live xUnit.net! There are several cool features, including aspect-like extensibility for tests, but the two changes that will immediately make a difference in my day-to-day coding are: [ExpectedException] is gone. In its place is Assert.Throws<T>( delegate … ). Not only much easier to read, but no longer can a test throw in…


The one where Toby finds a dependency injection container

Toby is less than happy. Due to some unforeseen circumstances, he recently lost all the code he’d been working on for the EDM project. For some unknown reason, he’d never bothered to setup a source control server and vows to not make the same mistake twice. Desperate to kick-start his excitement on the project again,…


Toby and the loss of domain knowledge

One morning, as Toby is drinking his cup of hot water, a thought strikes him – did the acceptance stories really cover everything he discovered about the domain in the first few days? Slightly worried, he finds the paragraph he so proudly wrote a while ago. The company is always working on a set of…


Toby and the mega-class deletion

So it’s become obvious that having a large, all-encompassing EDMSystem class was probably not the way to go. It did give us a way to express what we wanted our acceptance tests to do, but the time has come to bite the bullet and take a look at where the system is going. With the…


Toby and the step backwards

Being passionate about anything can have its drawbacks; in my zeal to give inside-out development a shot, I completely disregarded a couple principles I hold dear. SRP? Out the window. Test-first code? Left by the side of the road. I do have a set of what I’d call acceptance tests that are 85% complete given…

1

Toby and the complete stab in the dark

During my rather long wait for the plane in Dublin this morning, I had the opportunity to revisit Toby and his company’s EDM. Unfortunately, by the time I got to some stories, I was actually in the air with no internet access and as such had to just leave them for now. Regardless, here’s an…

3

The way of Testivus

I apologise for the lack of updates on Tony’s adventures—we have been busy doing integration work for Gatineau Beta 2. Our team from Dublin has some very cool stuff going in, and I’m looking forward to the day when I can post some screenshots. In the meantime, I ran across this very nice PDF file called…

2

The mess that mocks can make

Aside: I guess this post is really about mock frameworks rather than mocks, but I didn’t want to break the partial alliteration I had going in the title 🙂 A question was posed recently on one of our discussion lists about whether Rhino Mocks was a good framework to use for unit tests. As a…

8