When TDD Goes Bad, NUnit wasted 2 hours of my night

[TestFixture]
public class IHateNunit
{
    [Test]
    public void A_list_works()
    {
        IList<string> strs = new List<string>() { "asdf" };
 
        //Double Pass
        Assert.That(strs.Count, Is.EqualTo(1));
        Assert.That(strs, Has.Count(1));
    }
    [Test]
    public void An_array_doesnt()
    {
        IList<string> strs = new string[] { "asdf" };
 
        //Pass
        Assert.That(strs.Count, Is.EqualTo(1));
 
        //#FAIL
        Assert.That(strs, Has.Count(1));
    }
}

4 thoughts on “When TDD Goes Bad, NUnit wasted 2 hours of my night

  1. Why not just use the Unit testing built into Visual Studio 2005 and up? Sorry if wondering that makes me sound clueless.

    Also, in Fluent NHibernate, is there a tool for generating the mapping classes? It would be much like MyGeneration does for regular NHibernate mappings and classes.

    Thanks!

  2. @Brian O

    I have always been an NUnit fan. This was really a problem with reflection and not really NUnit’s fault. It’s just a CLR oddity.

    As for Fluent, I really don’t know. I haven’t ever played around with generation so I can’t help. Sorry.