Latest Replies
Sunday
Oct122008

Know thy NUnit

Please, do not write code like this:

  Assert.AreEqual( genericLoggers.Count, plainLoggers.Count );
  for (int i = 0; i < genericLoggers.Count; i++)
  {
    Assert.AreEqual(
      genericLoggers[i].GetType(),
      plainLoggers[i].GetType(),
      "instances (" + i + ") should give the same type" );
  }

When you can have this:

CollectionAssert.AreEqual(genericLoggers, plainLoggers);
« Common IoC denominator for Autofac, Castle and Unity .NET Containers | Main | Resharper 4.5 »

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>