Home > Development > Assertion Classes in MSTest Framework

Assertion Classes in MSTest Framework

For the last couple of months I’ve been doing a lot of unit tests using MSTest framework. Although it is good to have special assertion classes to simplify verification of strings and collections names picked my framework developers are not very good as for me.

These classes are named StringAssert and CollectionAssert. Looks good at first glance. But took me some time to figure out they exist.

Lets think about context in which they are used. I’m doing assertions in tests and I definitely know about core assertion class named Assert. Suppose additional classes were named AssertString and AssertCollection. Small change in names would make dramatical change in discoverability. As I start typing for Assert class in IntelliSense I would see them next to core assertion class.

This example demonstrates that developers should think about usage context of classes when naming them.

Advertisement
Categories: Development Tags:
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.