Re: Assume
"Kelly Anderson" <[email protected]>
| Newsgroups | gmane.comp.windows.dotnet.nunit.devel |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Feb 15, 2008 at 2:24 PM, Daniel M. Pomerantz <[email protected]> wrote: > That makes perfect sense! I forgot about NUnit handling the exception > and was trying to come up with a way that you could implement it > yourself...and actually you can. You could, but that would involve a lot of duplicated code, I think. > Truth be told though NUnice should be > able to do that, and I like the concept. I can't think of a particular > situation where I would use it, but I'm sure it could come up! For the > record, as I'm sure you know, you can implement ExpectedException with > your own Try/Catch, and that was the pattern I was using. Yeah, I had to take a lot of those out of my co-worker's test code. Really compacted the code a lot to use ExpectedException, with much less duplication. > One good > thing about rolling your own ExpectedException, you can pinpoint/direct > exactly which line of code throws the exception with your own > try/catch. ExpectedException cannot do that. Do you Assert the line of code threw the exception that you expected? That seems like the Test is tied too closely to the implementation for my taste. -Kelly ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/