VERY cool. Thanks!
On Mon, Dec 15, 2008 at 12:42 AM, Jeff Brown <[email protected]> wrote:
>
> Better yet, use the MbUnit v3 Assert.Throws<> syntax (borrowed from
> xUnit.Net) which returns the exception object so you check other details as
> well.
>
> SomeException ex = Assert.Throws<SomeException>(() =>
> subject.DoSomething());
> Assert.AreEqual("Boom!", ex.Message);
>
> Jeff.
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On
> Behalf Of Philip Japikse
> Sent: Wednesday, December 10, 2008 1:15 PM
> To: [email protected]
> Subject: MbUnit Re: ExpectedArgumentException strangeness
>
>
> The [ExpectedArgumentException] is used to test to make sure that an
> exception is thrown. If it is not thrown, then you get a failed test with
> an ExpectedExceptionNotThrownException (or something like that).
>
> Make sure that you specify the typeof exception you are looking for at the
> finest granularity you can. If you set the typeof to be Exception, than
> any
> exception thrown will pass. If you want ArgumentNullExpection to fail,
> then
> specify the exact exception you are looking for (e.g.
> ArgumentOutOfRangeException)
>
> Phil
> Philip Japikse, MCSD.Net, MCDBA, CSM
> Principal Consultant
> Pinnacle Solutions, Inc
> [email protected]
> www.japikse.blogspot.com
> twitter/skimedic
> (513) 312-5664
>
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On
> Behalf Of Hugh
> Sent: Wednesday, December 10, 2008 4:11 PM
> To: MbUnit.User
> Subject: MbUnit ExpectedArgumentException strangeness
>
>
> Here's what I observe in a test fixture I'm writing:
>
> Given: a test method decorated with [ExpectedArgumentException].
> When: the system under test throws an ArgumentNullException.
> Then: The test passes.
>
> This seems wrong to me... Am I misundertanding the semantics of
> ExpectedArgumentException?
>
>
>
>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MbUnit.User" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MbUnitUser?hl=en
-~----------~----~----~----~------~----~------~--~---