Assert outside of TestMethod... and not throw exception... RRS feed

  • Question

  • What I am trying to do is something similar to the old Assert methods. I want to fail the test, from the production, code without throwing an error back to the calling TestMethod or return a extra message.

    Something like this...

    public void MyMethod()
        //Do stuff....
      catch (Exception ex)
        //Write to event log also.
        //Suppress error.
    public void MyMethodTest()

    However I get an error while trying this.


    Wednesday, July 7, 2010 2:53 PM

All replies

  • In NUnit I use this  technique which might be what you want. I assume it should still work in MSTest.
    Saturday, July 10, 2010 4:49 PM