Something I keep having to look up is testing MVC (5) responses. There are several types of responses you can return on a MVC method: Plain ol’ object. IHttpActionResult. HttpResponseMessage. Plain ol’ object Returning an object means that it will be converted to the format in the Request (e.g. JSON, XML). However, you have no…
Category: TDD
Unit testing file input
Unit tests are mandatory for any business logic. But what if your business logic is parsing and processing files? Then you will need files as input in your tests. At first, I thought about making an extra wrapper around reading the file and mocking the wrapper when parsing it. However, sometimes this is more complicated…
Unit test snippets
I am a big fan of making things easy for myself. When preparing the TDD Workshop for another round I found it increasingly tedious to type out every unit test function. Luckily, Visual Studio lets you create your own snippets, so I created one that would immediately generate something like this:
Learning by Teaching: TDD
Not too long ago I gave a workshop on using TDD. Not because I like to give workshops or presentations, I am horrible at public speaking (this is worthy of a blog post on its own by the way). However, I believe that the best way of studying something, is by teaching it. It forces…