Re: Asserting that a value is within an interval
"Charlie Poole" <[email protected]> Sat, 2 Aug 2008 10:13:28 -0700
| Newsgroups | gmane.comp.windows.dotnet.nunit.user |
|---|---|
| Message-ID | <004301c8f4c3$1763ddc0$6401a8c0@ferrari> |
Hi Simone, I had been working on one that would work like... Actually, I believe we have that... Assert.That( a, Is.EqualTo( b ).Within(2)); It's not presented as a range but it should work with any version of NUnit from 2.4.2 on. I also have code not yet checked in for a general range, i.e. Is.InRange(from, to). Charlie _____ From: [email protected] [mailto:[email protected]] On Behalf Of Simone Busoli Sent: Saturday, August 02, 2008 3:01 AM To: [email protected] Subject: [Nunit-users] Asserting that a value is within an interval Hello, I would like to do something like: int a = 3; int b = 5; Assert.That(a, Is.InRangeOf(2).From(b)); which means that b - 2 <= a <= b + 2. I couldn't come up with anything but c# 3 expressions to do subtraction and addition. If anyone's interested I can write a patch for this. ------------------------------------------------------------------------- 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-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nunit-users