Archive

Archive for January, 2009

A new world with MbUnit RowTest

January 21, 2009 akantos Leave a comment

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.

 
 

 

 

Categories: TDD Tags: