this passes for me.

[TestMethod]
        public void Test1()
        {
            try
            {
                throw new Exception("foo");
            }
            catch (Exception e)
            {


            }

        }


On 22/03/2012 10:59 AM, Stephen Price wrote:
Tried that. It then passes the test as soon as the exception is hit. not what I want, I just want it to handle the exception.

Interestingly, its saying theres a null exception unhandled despite me having a catch. How do you handle nested exceptions? Nested try catch's? I'm grasping at straws here... I thought a catch essentially "handles" the exception?

On Thu, Mar 22, 2012 at 10:46 AM, Wallace Turner <[email protected] <mailto:[email protected]>> wrote:

    [TestMethod]
           [ExpectedException(typeof(InvalidOperationException))]
           public void Foor()
           {


    On 22/03/2012 10:35 AM, Stephen Price wrote:

        Cross posting this, I'm on too many lists. Hope that doesn't
        offend...

        I've got a unit test that is throwing an exception. (Finally
        got it hitting my catch block) Its a smoke test so has a loop
        in it for every view. I want it to NOT fail the test if an
        exception is hit. I want it to output to debug window or
        whatever and continue.

        Is that possible? even when I handle the exception with a try
        catch block , it still fails the test.

        cheers,
        Stephen


Reply via email to