Vadim’s Weblog

Never stop learning.

Better alternative to unit test data.

Posted by Vadim on June 28, 2007

Roy Osherove created two posts about how to create test data for unit tests.  First one talks about encoding test data as part of your test xml comments and the second one is how to do the same using XtUnit custom attributes.  It’s much easier and requires less typing if you use MbUnit RowTest attribute.

        [RowTest]
        [Row("Select * from categories")]
        public void UseMbUnitRowTestAttribute(string actual)
        {
            string expected = "Select * from categories";
            Assert.AreEqual(expected, actual);
        }

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>