Have those break on exceptions on already, and when debugging it it hits
exceptions in the Prism code. I think its showing me the code as its been
decompiled by Resharper so is showing me the exceptions. Mainly due to it
not finding the view its after.
Those are the fails I need to know about so they can be looked at.
I've refactored the guts of the test into a method and then have a single
test for each view, with a timeout. It means I'll have to cut and paste a
unit test for each view I'm interested in, whereas before I was using
reflection to loop through a class with view names in it.

Bit more work but now when a test fails its for a single view. Don't really
want to waste more time on it. I'll come back to it later and probably
figure it out.

There are quite likely multiple threads, I'm assuming each EnqueueCallback
has its own thread. The regionManager.RequestNavigate seems to be the
problem.

First it hits an ArgumentException on GetItemMetadataOrThrow inside Prism
somewhere, then hits the same one again.
After that it hits some exceptions thrown from the viewmodel (possibly
something the test isn't providing that it needs... )

It does land on my catch but the test still fails.

Some days its all too hard. :)

On Thu, Mar 22, 2012 at 11:28 AM, David Kean <david.k...@microsoft.com>wrote:

>  I mean, it will/it should break in the last user code.****
>
> ** **
>
> *From:* ozdotnet-boun...@ozdotnet.com [mailto:
> ozdotnet-boun...@ozdotnet.com] *On Behalf Of *David Kean
> *Sent:* Wednesday, March 21, 2012 8:23 PM
> *To:* ozDotNet
> *Subject:* RE: unit tests and exception****
>
> ** **
>
> If you have Just My Code turned on, then you shouldn’t need to do this. It
> will break earlier.****
>
> ** **
>
> *From:* ozdotnet-boun...@ozdotnet.com
> [mailto:ozdotnet-boun...@ozdotnet.com] *On Behalf Of *Wallace Turner
> *Sent:* Wednesday, March 21, 2012 8:13 PM
> *To:* ozDotNet
> *Subject:* Re: unit tests and exception****
>
> ** **
>
> Run the unit test debugging and ensure you have break on exceptions ticked:
>
>
> On 22/03/2012 11:10 AM, Stephen Price wrote: ****
>
> Ok, I must have an unhandled exception getting through still. What happens
> if more than one exception is thrown? Maybe its related to the unit test
> running asyncronously?  ****
>
> ** **
>
> I'm thinking its going to be more work but might be better to have a
> single unit test per view. ****
>
> On Thu, Mar 22, 2012 at 11:07 AM, Wallace Turner <wallacetur...@gmail.com>
> wrote:****
>
> 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 <wallacetur...@gmail.com>
> 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****
>
> ** **
>
>   ** **
>

<<image001.jpg>>

Reply via email to