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

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: