Re: Assume

"Vaughn, Clifton" <[email protected]>
Newsgroups gmane.comp.windows.dotnet.nunit.devel
Message-ID <C1A113F58C449C43AD6FB79FCEF64CDA068187C4@dsp62mail.na.bestbuy.com>
Yeah, I replied without reading other messages.  I saw when you pointed
it out to Kelly

Thanks

cliff

> -----Original Message-----
> From: Daniel M. Pomerantz [mailto:[email protected]]
> Sent: Friday, February 15, 2008 5:03 PM
> To: Vaughn, Clifton
> Cc: Kelly Anderson; [email protected]
> Subject: Re: [nunit-developer] Assume
> 
> Hi Cliff,
> 
> It isn't the same.  Look for the line that says "//Do some stuff here"
> That is the difference.  There is in fact a difference.  Other people
> may not see it.  Other people may not appreciate it.  I myself don't
use
> it, but there is a difference, and if you ask me, it's an important
one.
> 
> dmp
> 
> Vaughn, Clifton wrote:
> >> All I'm saying here is that if you have
> >>
> >> [ExpectedException(typeof(InvalidCastException))]
> >>
> >> And the test passes, all you know is that some line of code caused
an
> >> invalid cast exception to be thrown.  I supposed you can have some
> >> degree of certainty that the line you wanted to throw the exception
> >>
> > did,
> >
> >> but I don't know of a way to enforce that.
> >>
> >> Compare that too this:
> >>
> >> public void foo()
> >> {
> >>     //Do some stuff here
> >>
> >>     try
> >>     {
> >>         DoSomethingThatThrowsAnException();
> >>
> >>         Assert.Fail("Exception not Thrown");
> >>     }
> >>     catch (InvalidCastException ex)
> >>     {
> >>         //Do Nothing...Swallow it
> >>     }
> >> }
> >>
> >>
> >> In this case, you know exactly which line of code raised the
> >>
> > exception.
> >
> >> I'm not saying it's easier to maintain - To be 100% clear, I remove
> >>
> > this
> >
> >> second example of code and replace it with the first when I see it,
as
> >> do you.  My point is that you have a bit more certainty that what
> >> happened is what you expected with this example, for better or for
> >>
> > worse.
> >
> >
> > [cliff] this doesn't seem any different than
> > [ExpectedException]
> > Public void foo()
> > {
> > DoSomethingThatThrowsAnException();
> > }
> >
> > It says the same and with less code and IMHO is more clearer.
> >
> >
> >

-------------------------------------------------------------------------
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/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.