Re: Key word suggestions?
"Olof Bjarnason" <[email protected]> Mon, 8 Sep 2008 23:23:15 +0200
| Newsgroups | gmane.comp.windows.dotnet.nunit.devel |
|---|---|
| Message-ID | <[email protected]> |
2008/9/8 Charlie Poole <[email protected]>: > 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. And I must confess while re-reading the code I typed above, I'm not entirely sure it is valid C# :) Since IComparer is an interface and not a delegate type, that is.. Not at a compiler so cannot really verify nor falsify, but my gut feeling is "not possible". So will it be UsingComparer at the end of the day anyway..? :) > >> 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=/ > _______________________________________________ > nunit-developer mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/nunit-developer > ------------------------------------------------------------------------- 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=/