Re: Assume
"Charlie Poole" <[email protected]>
| Newsgroups | gmane.comp.windows.dotnet.nunit.devel |
|---|---|
| Message-ID | <001801c8701c$9ec27b40$6401a8c0@ferrari> |
Hi Daniel, That would definitely be the way to implement it at test run time. I just don't see the usefulness of an interface that lets users specify something called an assumption and then ignores it when it fails. I do understand how Assume would be used as a "clause" in a theory specification, but as a standalone verb the semantics seem wrong to me. Essentially, if a is called, I want it to do its job, not say "Oh, this data isn't useful, so I'll just return" Something outside the test should be feeding it useful data, IMO. Charlie > -----Original Message----- > From: Daniel M. Pomerantz [mailto:[email protected]] > Sent: Friday, February 15, 2008 12:45 PM > To: Charlie Poole > Cc: 'Kelly Anderson'; [email protected] > Subject: Re: [nunit-developer] Assume > > How about anything inside of Assume throws an AssumptionException. > > Inside of your code, wrap your method inside of a try that > catches AssumptionExceptions and then swallows it. That way, > you can succeed even if the assumptions fail? > > dmp > > Charlie Poole wrote: > > Hi Kelly, > > > > > >> I didn't see that you responded to the idea of creating > an Assume > >> class that was the same as the Assert class, except that > instead of > >> throwing the exception, it just returned silently if the result > >> returned true. > >> > >> The example was: > >> > >> [Test] > >> public void Divide() > >> { > >> Assume.That(denominator, Is.Not(0)); > >> Assert.That( ... numerator/denominator ...); } > >> > >> Would that be easy or hard? > >> > > > > Well, I don't know how to do it in normal managed code - > assuming you > > mean return from the Divide method. > > > > However, I don't think you want it to just return, which > would imply a > > successful test. Rather, you probably mean to have it return some > > indication that this particular data is not being used... right? > > > > > >> Do you think it's worth having? > >> > > > > As part of a full-fledged Theory implementation, Yes. > > As a separate thing, I can't see much value. > > > > Charlie > > > > > >> -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/ > >> _______________________________________________ > >> nunit-developer mailing list > >> [email protected] > >> https://lists.sourceforge.net/lists/listinfo/nunit-developer > >> > >> > > > > > > > > > ---------------------------------------------------------------------- > > --- 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/ > > _______________________________________________ > > nunit-developer mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/nunit-developer > > > > > > > ------------------------------------------------------------------------- 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/