I was doing a bit of work with Tweetdeck open, when I noticed this tweet.
Dear .Net world, please stop writing barely readable unit tests with the old fashioned Assert.IsTrue()/AreEqual()/etc. syntax
— jeremydmiller (@jeremydmiller) August 7, 2016
I’ve been using Assert.IsTrue() and its friends for years, so you might think I would take offense. But instead, this struck me as an interesting and provocative statement. I scanned through the conversation this started and it got me to thinking.
Over the years, I’ve evolved my unit tests heavily in the name of readability. I’ve come to favor mocking frameworks on the basis of having fluent APIs and readable setup. On a pointer from Steve Smith, I’ve adopted his philosophy and approach to naming unit test classes and tests. My arrange and act inside of the tests have become highly readable and optimized for comprehension.
But then, there’s Assert.AreEqual. Same as it ever was.