Assert Messages Are Not Optional

…and now, in this week’s episode of Zero-Friction TDD: Optional Assert messages that aren’t optional anyway! Actually, this piece of advice comes almost directly from the xUnit Test Patterns book, so I was in doubt whether I should post it all, but it bears repeating, and I guess I still have a few things to…


First Dynamics Mobile Post

Yesterday, I posted my first post over on the Microsoft Dynamics Mobile Team blog. More are likely to follow. In case you are wondering what this means for this blog, the answer is: Nothing. I plan to continue blogging in more or less the same vein as I’ve done for the last three years now.


Why Use AreEqual<T>?

This is a post in my Zero-Friction TDD series. One of my colleagues recently asked my why I prefer Assert.AreEqual<T> over one of the non-generic Assert.AreEqual overloads for primitive types. In most cases, I’m very happy with the C# compiler’s ability to infer generic type arguments from the method call parameters, but this case is…


3 Is Many

This is an installment in my Zero-Friction TDD series. When I was a kid, my parents taught me that many is any number above three two*; they used the simple counting sequence one, two, many. This little story may make me seem like I was an incredibly dim-witted kid, but the point was obviously not…


Creating Azure Tables From Script

When working with the Windows Azure Storage service, you must create the tables before you can use them; in essence, defining the ‘schema’ of your Azure storage service. On his blog, Steve Marx writes: “Probably the best solution is to have separate initialization code that creates your tables.  This is analogous to the pattern of…


testmethod Code Snippet

This is an installment in my Zero-Friction TDD series. If you are a regular reader of this blog, you may have noticed a certain pattern in my unit test examples (like this one). This is because I always follow the Four-Phase Test pattern (which is a superset of the more well-know Triple-A (Arrange Act Assert)…


Ignore Irrelevant Return Values

This is an installment in my Zero-Friction TDD series. Sometimes, you don’t care about the return value from a particular operation. The simplest example is if you want to check that creating a new instance of a specific type will throw an exception if supplied with wrong parameter values: [ExpectedException(typeof(ArgumentNullException))][TestMethod]public void CreateWithNullTextWillThrow(){    // Fixture setup   …


Microsoft Dynamics Mobile 1.5 Released

If you are wondering about what I’m doing these days, we (the Microsoft Dynamics Mobile Team) just released a new version of Microsoft Dynamics Mobile! And there was much rejoicing 🙂


Anonymous Variables

This post is an installment in my series on Zero-Friction TDD. Often when writing a unit test, the SUT’s API will force you to create objects that you really don’t care about. As an example, take a look at the signature of this constructor: public Plop(int number, string text) To create an instance of the…


Naming Direct Output Variables

In my series of Zero-Friction TDD tips and tricks, it’s time to look at naming Direct Output variables. [TestMethod]public void DoStuffWillReturnMessage(){    // Fixture setup    string expectedResult = “ploeh”;    MyClass sut = new MyClass();    // Exercise system    string result = sut.DoStuff(expectedResult);    // Verify outcome    Assert.AreEqual<string>(expectedResult, result, “DoStuff”);    // Teardown} As you can see, I use the…