Home > About nothing, C# > Yoda style unit testing

Yoda style unit testing

Few days ago we were doing a new algorithm for a existing (and slow) feature. Basically, the algorithm returns a list of strings, and the way we choose to test it is to trust the first one and run both algorithms looking for the same result in both. The first line of the assertion is natural:

Assert.AreEqual(resultOld.Count,resultNew.Count);

But the second one seems to be coded by Yoda

Assert.That(resultOld.All(resultNew.Contains));

Ok, it’s not actually a Yoda style sentence, but I found it quite funny.

Advertisements
Categories: About nothing, C# 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: