Friday, April 30, 2004

MbUnit features a new test decorator that asserts that the duration of the test is less than some values. DurationAttribute usage is quite intuitive as shown in the example below:

[TestFixture]
public class DurationAttributeTest
{
    [Test]
    [Duration(1,"This method succeeds (has 1 second to succeed")]
    public void EmptyMethod()
    {}

   [Test]
   [Duration(0,"This method will fail because it will  run in more that 0 seconds!")]
   public void EmptyMethodFails()
   {
      Console.WriteLine("Take your time");
   }
}
posted on Saturday, May 01, 2004 4:47:00 AM UTC  #    Comments [3]
Tracked by:
"rebecca smyth" (online) [Trackback]
"christian dating man" (online) [Trackback]
Monday, June 06, 2005 6:06:42 PM UTC
Peli's Blog
Monday, June 06, 2005 6:06:52 PM UTC
Peli's Blog
Monday, June 06, 2005 6:06:52 PM UTC
Wow, superb!
<br>Thanks.
Diana
Comments are closed.