Re: Key word suggestions?
"Charlie Poole" <[email protected]> Mon, 8 Sep 2008 14:08:48 -0700
| Newsgroups | gmane.comp.windows.dotnet.nunit.devel |
|---|---|
| Message-ID | <014201c911f7$16b9f610$6401a8c0@ferrari> |
Hi Olof,
> Which case is more common (I know that may be a hard question
> to answer!):
>
> Assert.That( data, Is.EqualTo(expected).Using(myComparer);
>
> .. or
>
> Assert.That( data,
> Is.EqualTo(expected).Using(delegate(MyClass a, MyClass b) {
> return a.Name.CompareTo(b.Name); });
>
Easy choice for me since I never tought about using a delegate
in that position. Darn! I Don't have tests for that.
> The latter may well become (if not already!) the more common
> with the shorter syntax of .NET3.5: (or is it 3.0..? Don't
> you just hate it when big versions come so close they are
> hard to distinguish..?):
>
> Assert.That( data, Is.EqualTo(expected).Using( (a,b) =>
> a.Name.CompareTo(b.Name) );
It's short but not easy to read in my opinion. However, I guess
we have to support it.
> What I mean is that choosing the short name "Using" might be
> a little too brief without the added readability of the
> variable name "myComparer", given the most ubiqous use case
> (?) of an anonymous IComparer ...
That's what we have these lists for! Like I said, I never
thought of anyone doing that.
Charlie
> >
> > Charlie :-)
> >
> >
> >
> >
>
-------------------------------------------------------------------------
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=/