Re: Assume
"Daniel M. Pomerantz" <[email protected]>
| Newsgroups | gmane.comp.windows.dotnet.nunit.devel |
|---|---|
| Message-ID | <[email protected]> |
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/