2

I have a constructor as follows

public class MyClass
{
   public MyClass()
   {

   }
}

While writing test cases, i used Assert.Pass(). But it throws an exception of type ArguementNullException

Chris Missal
  • 5,987
  • 3
  • 28
  • 46
user2435880
  • 71
  • 2
  • 8

2 Answers2

2

The SuccessException is a convenience for a test runner. This allows you to pass a test and record an optional message. The better way to approach this is to just let the test finish without throwing any exceptions or recording failed assertions.

More info here: http://www.nunit.org/index.php?p=utilityAsserts&r=2.5

Chris Missal
  • 5,987
  • 3
  • 28
  • 46
  • Sorry i made a mistake in the question. It throws an "arguementnull" Exception. i have used the same (Assert.Pass()) in other projects in my solution. Now i'm trying to use this in a console application which is a part of the same solution. is there any different approach this to avoid exception. – user2435880 Jun 27 '13 at 07:08
  • 2
    guys it got solved. I added a Isolate.Swap.AllInstances().With(fakeMyClass); – user2435880 Jun 27 '13 at 09:47
0

If you're using NUnit framework,

Assert.Pass<SuccessException>();

when you want to pass a test.