A new world with MbUnit RowTest

One thing I love the most on MbUnit is RowTest functionality. It brings the possibility of removing extra lines of code and keep all test clean and functional.
For example, testing e-mails:

[
RowTest]
[
Row(“eduardo@temploxv.pro.br”, false)]
[
Row(“edu@temploxv.com.br”, true)]
public void CheckEmail(string email, bool Expected)
{
    bool Result;
     Result = false;

    
this.Email = email;

    Console.WriteLine(“cheking on email {0}”, email);

    Result = _controller.CheckEmail();
   Assert.AreEqual(Result, Expected);
} 

You may consider use this for validation like that. But pay attention to the Row tag which doesn’t have parameters for expected values. To your assertion works you may actually need create a parameter for the value expected to be.

 
 

 

 

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: