Re: [Nunit-users] Blog: Four Ways to test Expected Exceptions

"Charlie Poole" <[email protected]> Sun, 3 Aug 2008 09:43:05 -0700
Newsgroups gmane.comp.windows.dotnet.nunit.devel
Message-ID <004201c8f588$02a6c3a0$6401a8c0@ferrari>
In fact, due to some compiler magic, that does work.

Charlie


  _____  

From: David Jeske [mailto:[email protected]] 
Sent: Sunday, August 03, 2008 8:38 AM
To: Charlie Poole
Cc: [email protected]; [email protected]
Subject: Re: [Nunit-users] Blog: Four Ways to test Expected Exceptions


I admit that I have not experimented with anonymous delegates, but my
assumption about how they are implemented in the runtime say that I don't
expect they have access to local scope... that is, I don't expect I could do
this:

DbHandle db = Db.open()
Assert.That( delegate { db.do_something(); },
Throws.Exception<MyException>() );

If I can, then I should definetly switch to this syntax. 



On Sat, Aug 2, 2008 at 4:38 PM, Charlie Poole <[email protected]>
wrote:


I think I'm missing something... Why isn't that code equivaent to... 
 
Assert.That(  delegate { do_something() }, Throws.Exception<MyException>()
);

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

_______________________________________________
nunit-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nunit-developer