Discussion:
Key word suggestions?
Charlie Poole
2008-09-06 18:03:08 UTC
Permalink
Hi All,

EqualConstraint takes a modifier "Comparer(IComparer comparer)",
which causes the specified IComparer to be used when testing
for equality.

This same feature is being added in other constraints, like
OrderedCollectionConstraint.

Before we get too many of them, I want to ask if "Comparer"
is the best way to express this. Other options that come
to mind are

CompareWith(IComparer)
CompareUsing(IComparer)
UseComparer(IComparer)
Using(IComparer)
...

It's a smallish issue, but I thought I'd ask.

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=/
Daaron Dwyer
2008-09-07 00:50:59 UTC
Permalink
I'd suggest CompareWith rather than Using, as Using has other connotations.
Post by Charlie Poole
Hi All,
EqualConstraint takes a modifier "Comparer(IComparer comparer)",
which causes the specified IComparer to be used when testing
for equality.
This same feature is being added in other constraints, like
OrderedCollectionConstraint.
Before we get too many of them, I want to ask if "Comparer"
is the best way to express this. Other options that come
to mind are
CompareWith(IComparer)
CompareUsing(IComparer)
UseComparer(IComparer)
Using(IComparer)
...
It's a smallish issue, but I thought I'd ask.
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
https://lists.sourceforge.net/lists/listinfo/nunit-developer
Matt
2008-09-08 16:46:15 UTC
Permalink
Post by Charlie Poole
Using(IComparer)
I like this one the best.

--
tangled strands of DNA explain the way that I behave.
http://www.clock.org/~matt

-------------------------------------------------------------------------
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=/
Olof Bjarnason
2008-09-08 17:51:13 UTC
Permalink
Charlie could we get a complete line of sourcecode to make a better judgement..?
Post by Charlie Poole
Hi All,
EqualConstraint takes a modifier "Comparer(IComparer comparer)",
which causes the specified IComparer to be used when testing
for equality.
This same feature is being added in other constraints, like
OrderedCollectionConstraint.
Before we get too many of them, I want to ask if "Comparer"
is the best way to express this. Other options that come
to mind are
CompareWith(IComparer)
CompareUsing(IComparer)
UseComparer(IComparer)
Using(IComparer)
...
It's a smallish issue, but I thought I'd ask.
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
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=/
Charlie Poole
2008-09-08 18:43:23 UTC
Permalink
Hi Olof,

A good idea... here are two sets using different constraints

Assert.That( data, Is.EqualTo(expected).Comparer(myComparer);
Assert.That( data, Is.EqualTo(expected).CompareWith(myComparer);
Assert.That( data, Is.EqualTo(expected).Using(myComparer);
Assert.That( data, Is.EqualTo(expected).UseComparer(myComparer);
etc.

and

Assert.That(myCollection, Is.OrderedBy("Key").Comparer(myComparer);
Assert.That(myCollection, Is.OrderedBy("Key").CompareWith(myComparer);
Assert.That(myCollection, Is.OrderedBy("Key").Using(myComparer);
Assert.That(myCollection, Is.OrderedBy("Key").UseComparer(myComparer);
etc.

Currently those are the only two places where this modifier is
used, but I see making more use of it in future. My working
assumption is that it will generally be easier for users
if we use the same word in all cases, even though they are
technically independent.

Charlie
-----Original Message-----
Sent: Monday, September 08, 2008 10:51 AM
To: Charlie Poole
Subject: Re: [nunit-developer] Key word suggestions?
Charlie could we get a complete line of sourcecode to make a
better judgement..?
Post by Charlie Poole
Hi All,
EqualConstraint takes a modifier "Comparer(IComparer
comparer)", which
Post by Charlie Poole
causes the specified IComparer to be used when testing for equality.
This same feature is being added in other constraints, like
OrderedCollectionConstraint.
Before we get too many of them, I want to ask if "Comparer"
is the best way to express this. Other options that come to mind are
CompareWith(IComparer)
CompareUsing(IComparer)
UseComparer(IComparer)
Using(IComparer)
...
It's a smallish issue, but I thought I'd ask.
Charlie
----------------------------------------------------------------------
Post by Charlie Poole
--- This SF.Net email is sponsored by the Moblin Your Move
Developer's
Post by Charlie Poole
challenge Build the coolest Linux based applications with
Moblin SDK &
Post by Charlie Poole
win great prizes Grand prize is a trip for two to an Open
Source event
Post by Charlie Poole
anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
nunit-developer mailing list
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=/
Olof Bjarnason
2008-09-08 19:07:40 UTC
Permalink
Post by Charlie Poole
Hi Olof,
A good idea... here are two sets using different constraints
Assert.That( data, Is.EqualTo(expected).Comparer(myComparer);
Assert.That( data, Is.EqualTo(expected).CompareWith(myComparer);
Assert.That( data, Is.EqualTo(expected).Using(myComparer);
Assert.That( data, Is.EqualTo(expected).UseComparer(myComparer);
Just playing a little:

Assert.That( data, Is.EqualTo(expected).UseComparer(myComparer);
Assert.That( data, Is.EqualTo(expected).UsingComparer(myComparer);
Assert.That( data, Is.EqualTo(expected).WhereEqualMeans(myComparer);
Post by Charlie Poole
etc.
and
Assert.That(myCollection, Is.OrderedBy("Key").Comparer(myComparer);
Assert.That(myCollection, Is.OrderedBy("Key").CompareWith(myComparer);
Assert.That(myCollection, Is.OrderedBy("Key").Using(myComparer);
Assert.That(myCollection, Is.OrderedBy("Key").UseComparer(myComparer);
Assert.That(myCollection, Is.OrderedBy("Key").UsingComparer(myComparer);

Reading it aloud:

'Assert that myCollection is ordered by "Key" using comparer myComparer'

If forced to choose one for both scenarios my choice would be
"UsingComparer", even though it is not on your original list :)
Post by Charlie Poole
etc.
Currently those are the only two places where this modifier is
used, but I see making more use of it in future. My working
assumption is that it will generally be easier for users
if we use the same word in all cases, even though they are
technically independent.
Charlie
-----Original Message-----
Sent: Monday, September 08, 2008 10:51 AM
To: Charlie Poole
Subject: Re: [nunit-developer] Key word suggestions?
Charlie could we get a complete line of sourcecode to make a
better judgement..?
Post by Charlie Poole
Hi All,
EqualConstraint takes a modifier "Comparer(IComparer
comparer)", which
Post by Charlie Poole
causes the specified IComparer to be used when testing for equality.
This same feature is being added in other constraints, like
OrderedCollectionConstraint.
Before we get too many of them, I want to ask if "Comparer"
is the best way to express this. Other options that come to mind are
CompareWith(IComparer)
CompareUsing(IComparer)
UseComparer(IComparer)
Using(IComparer)
...
It's a smallish issue, but I thought I'd ask.
Charlie
----------------------------------------------------------------------
Post by Charlie Poole
--- This SF.Net email is sponsored by the Moblin Your Move
Developer's
Post by Charlie Poole
challenge Build the coolest Linux based applications with
Moblin SDK &
Post by Charlie Poole
win great prizes Grand prize is a trip for two to an Open
Source event
Post by Charlie Poole
anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
nunit-developer mailing list
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=/
Charlie Poole
2008-09-08 20:19:16 UTC
Permalink
Hi Olof
Post by Olof Bjarnason
'Assert that myCollection is ordered by "Key" using comparer
myComparer'
If forced to choose one for both scenarios my choice would be
"UsingComparer", even though it is not on your original list :)
Yes it was. You missed this one...
Post by Olof Bjarnason
etc.
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=/
Olof Bjarnason
2008-09-08 20:56:42 UTC
Permalink
Post by Charlie Poole
Hi Olof
Post by Olof Bjarnason
'Assert that myCollection is ordered by "Key" using comparer
myComparer'
If forced to choose one for both scenarios my choice would be
"UsingComparer", even though it is not on your original list :)
Yes it was. You missed this one...
Post by Olof Bjarnason
etc.
Heh. :)

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); });

?

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) );

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 ...
Post by Charlie Poole
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=/
Charlie Poole
2008-09-08 21:08:48 UTC
Permalink
Hi Olof,
Post by Olof Bjarnason
Which case is more common (I know that may be a hard question
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.
Post by Olof Bjarnason
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
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.
Post by Olof Bjarnason
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
Post by Olof Bjarnason
Post by Charlie Poole
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=/
Olof Bjarnason
2008-09-08 21:23:15 UTC
Permalink
Post by Charlie Poole
Hi Olof,
Post by Olof Bjarnason
Which case is more common (I know that may be a hard question
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..? :)
Post by Charlie Poole
Post by Olof Bjarnason
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
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.
Post by Olof Bjarnason
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
Post by Olof Bjarnason
Post by Charlie Poole
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
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=/
Charlie Poole
2008-09-08 23:56:49 UTC
Permalink
Hi Olof,
Post by Olof Bjarnason
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".
I agree - although an overload woud make it possible.

I'll wait for demand, since I'm not personally inclined to
the anonymous route for this purpose.
Post by Olof Bjarnason
So will it be UsingComparer at the end of the day anyway..? :)
For me it's between that and CompareUsing. I liked CompareWith
till I realized it could be taken as CompareWith( someValue ).

Charlie
Post by Olof Bjarnason
Post by Olof Bjarnason
The latter may well become (if not already!) the more
common with the
Post by Olof Bjarnason
shorter syntax of .NET3.5: (or is it 3.0..? Don't you just hate it
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.
Post by Olof Bjarnason
What I mean is that choosing the short name "Using" might
be a little
Post by Olof Bjarnason
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
Post by Olof Bjarnason
Post by Charlie Poole
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
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=/
Olof Bjarnason
2008-09-09 06:11:20 UTC
Permalink
Post by Charlie Poole
Hi Olof,
Post by Olof Bjarnason
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".
I agree - although an overload woud make it possible.
I'll wait for demand, since I'm not personally inclined to
the anonymous route for this purpose.
Post by Olof Bjarnason
So will it be UsingComparer at the end of the day anyway..? :)
For me it's between that and CompareUsing. I liked CompareWith
till I realized it could be taken as CompareWith( someValue ).
For me CompareUsing sounds like something "outside of the sentence".
It just does not read with flow:

"Assert that myObj is equal to expected value compare using mycomparer"

vs.

"Assert that myObj is equal to expected value using comparer mycomparer"
Post by Charlie Poole
Charlie
Post by Olof Bjarnason
Post by Olof Bjarnason
The latter may well become (if not already!) the more
common with the
Post by Olof Bjarnason
shorter syntax of .NET3.5: (or is it 3.0..? Don't you just hate it
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.
Post by Olof Bjarnason
What I mean is that choosing the short name "Using" might
be a little
Post by Olof Bjarnason
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
Post by Olof Bjarnason
Post by Charlie Poole
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
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=/

Charlie Poole
2008-09-08 20:24:39 UTC
Permalink
Hi Olof,

Some folks didn't like "Using" but assuming it takes
an IComparer as an argument and that comparers are
usually named SomeSortOfComparer, what about just
plain...

Assert.That( data, Is.EqualTo(expected).Using(myComparer);

Of course "Using" is fairly generic, but any future
overloads could be distinguished by their argument.

I'm pretty sure there's no confusion with C# using.

Charlie
-----Original Message-----
Behalf Of Olof Bjarnason
Sent: Monday, September 08, 2008 12:08 PM
To: Charlie Poole
Subject: Re: [nunit-developer] Key word suggestions?
Post by Charlie Poole
Hi Olof,
A good idea... here are two sets using different constraints
Assert.That( data, Is.EqualTo(expected).Comparer(myComparer);
Assert.That( data, Is.EqualTo(expected).CompareWith(myComparer);
Assert.That( data, Is.EqualTo(expected).Using(myComparer);
Assert.That( data, Is.EqualTo(expected).UseComparer(myComparer);
Assert.That( data, Is.EqualTo(expected).UseComparer(myComparer);
Assert.That( data, Is.EqualTo(expected).UsingComparer(myComparer);
Assert.That( data, Is.EqualTo(expected).WhereEqualMeans(myComparer);
Post by Charlie Poole
etc.
and
Assert.That(myCollection, Is.OrderedBy("Key").Comparer(myComparer);
Assert.That(myCollection,
Is.OrderedBy("Key").CompareWith(myComparer);
Assert.That(myCollection, Is.OrderedBy("Key").Using(myComparer);
Assert.That(myCollection,
Is.OrderedBy("Key").UseComparer(myComparer);
Assert.That(myCollection,
Is.OrderedBy("Key").UsingComparer(myComparer);
'Assert that myCollection is ordered by "Key" using comparer
myComparer'
If forced to choose one for both scenarios my choice would be
"UsingComparer", even though it is not on your original list :)
Post by Charlie Poole
etc.
Currently those are the only two places where this modifier
is used,
Post by Charlie Poole
but I see making more use of it in future. My working assumption is
that it will generally be easier for users if we use the
same word in
Post by Charlie Poole
all cases, even though they are technically independent.
Charlie
-----Original Message-----
Sent: Monday, September 08, 2008 10:51 AM
To: Charlie Poole
Subject: Re: [nunit-developer] Key word suggestions?
Charlie could we get a complete line of sourcecode to make
a better
Post by Charlie Poole
judgement..?
Post by Charlie Poole
Hi All,
EqualConstraint takes a modifier "Comparer(IComparer
comparer)", which
Post by Charlie Poole
causes the specified IComparer to be used when testing
for equality.
Post by Charlie Poole
Post by Charlie Poole
This same feature is being added in other constraints, like
OrderedCollectionConstraint.
Before we get too many of them, I want to ask if "Comparer"
is the best way to express this. Other options that come to mind are
CompareWith(IComparer)
CompareUsing(IComparer)
UseComparer(IComparer)
Using(IComparer)
...
It's a smallish issue, but I thought I'd ask.
Charlie
---------------------------------------------------------------------
Post by Charlie Poole
-
Post by Charlie Poole
--- This SF.Net email is sponsored by the Moblin Your Move
Developer's
Post by Charlie Poole
challenge Build the coolest Linux based applications with
Moblin SDK &
Post by Charlie Poole
win great prizes Grand prize is a trip for two to an Open
Source event
Post by Charlie Poole
anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
nunit-developer mailing list
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=/
_______________________________________________
nunit-developer mailing list
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=/
Hans Christian Falkenberg
2008-09-08 20:37:52 UTC
Permalink
Post by Charlie Poole
Hi Olof,
Some folks didn't like "Using" but assuming it takes
an IComparer as an argument and that comparers are
usually named SomeSortOfComparer, what about just
plain...
Assert.That( data, Is.EqualTo(expected).Using(myComparer);
Of course "Using" is fairly generic, but any future
overloads could be distinguished by their argument.
I'm pretty sure there's no confusion with C# using.
Except in poor syntax highlighters. Which I'm sure there are
at least a couple of (think code posted on the web).
FxCop warns against this (CA1716)
http://msdn.microsoft.com/en-us/library/ms182248(VS.80).aspx

Indeed if you look at the MS documentation shipped with
Visual Studio for System.Random.Next(), the Visual Basic
code example incorrectly highlights the method as a keyword.

My vote is on UsingComparer because it avoids keywords clashes
and makes it perfectly clear what it is you are using from
a glance.

+ Hans Christian
Post by Charlie Poole
Charlie
-----Original Message-----
Behalf Of Olof Bjarnason
Sent: Monday, September 08, 2008 12:08 PM
To: Charlie Poole
Subject: Re: [nunit-developer] Key word suggestions?
Post by Charlie Poole
Hi Olof,
A good idea... here are two sets using different constraints
Assert.That( data, Is.EqualTo(expected).Comparer(myComparer);
Assert.That( data, Is.EqualTo(expected).CompareWith(myComparer);
Assert.That( data, Is.EqualTo(expected).Using(myComparer);
Assert.That( data, Is.EqualTo(expected).UseComparer(myComparer);
Assert.That( data, Is.EqualTo(expected).UseComparer(myComparer);
Assert.That( data, Is.EqualTo(expected).UsingComparer(myComparer);
Assert.That( data, Is.EqualTo(expected).WhereEqualMeans(myComparer);
Post by Charlie Poole
etc.
and
Assert.That(myCollection, Is.OrderedBy("Key").Comparer(myComparer);
Assert.That(myCollection,
Is.OrderedBy("Key").CompareWith(myComparer);
Assert.That(myCollection, Is.OrderedBy("Key").Using(myComparer);
Assert.That(myCollection,
Is.OrderedBy("Key").UseComparer(myComparer);
Assert.That(myCollection,
Is.OrderedBy("Key").UsingComparer(myComparer);
'Assert that myCollection is ordered by "Key" using comparer
myComparer'
If forced to choose one for both scenarios my choice would be
"UsingComparer", even though it is not on your original list :)
Post by Charlie Poole
etc.
Currently those are the only two places where this modifier
is used,
Post by Charlie Poole
but I see making more use of it in future. My working assumption is
that it will generally be easier for users if we use the
same word in
Post by Charlie Poole
all cases, even though they are technically independent.
Charlie
-----Original Message-----
Sent: Monday, September 08, 2008 10:51 AM
To: Charlie Poole
Subject: Re: [nunit-developer] Key word suggestions?
Charlie could we get a complete line of sourcecode to make
a better
Post by Charlie Poole
judgement..?
Post by Charlie Poole
Hi All,
EqualConstraint takes a modifier "Comparer(IComparer
comparer)", which
Post by Charlie Poole
causes the specified IComparer to be used when testing
for equality.
Post by Charlie Poole
Post by Charlie Poole
This same feature is being added in other constraints, like
OrderedCollectionConstraint.
Before we get too many of them, I want to ask if "Comparer"
is the best way to express this. Other options that come to mind are
CompareWith(IComparer)
CompareUsing(IComparer)
UseComparer(IComparer)
Using(IComparer)
...
It's a smallish issue, but I thought I'd ask.
Charlie
---------------------------------------------------------------------
Post by Charlie Poole
-
Post by Charlie Poole
--- This SF.Net email is sponsored by the Moblin Your Move
Developer's
Post by Charlie Poole
challenge Build the coolest Linux based applications with
Moblin SDK &
Post by Charlie Poole
win great prizes Grand prize is a trip for two to an Open
Source event
Post by Charlie Poole
anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
nunit-developer mailing list
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=/
_______________________________________________
nunit-developer mailing list
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=/
_______________________________________________
nunit-developer mailing list
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=/
Charlie Poole
2008-09-08 21:04:51 UTC
Permalink
Hi Hans Christian,
Post by Hans Christian Falkenberg
Post by Charlie Poole
I'm pretty sure there's no confusion with C# using.
Except in poor syntax highlighters. Which I'm sure there are
at least a couple of (think code posted on the web).
FxCop warns against this (CA1716)
http://msdn.microsoft.com/en-us/library/ms182248(VS.80).aspx
Indeed if you look at the MS documentation shipped with
Visual Studio for System.Random.Next(), the Visual Basic code
example incorrectly highlights the method as a keyword.
My vote is on UsingComparer because it avoids keywords
clashes and makes it perfectly clear what it is you are using
from a glance.
Point taken. I'll not use using. :-)

Charlie
Post by Hans Christian Falkenberg
+ Hans Christian
Post by Charlie Poole
Charlie
-----Original Message-----
Behalf Of
Post by Charlie Poole
Olof Bjarnason
Sent: Monday, September 08, 2008 12:08 PM
To: Charlie Poole
Subject: Re: [nunit-developer] Key word suggestions?
Post by Charlie Poole
Hi Olof,
A good idea... here are two sets using different constraints
Assert.That( data, Is.EqualTo(expected).Comparer(myComparer);
Assert.That( data, Is.EqualTo(expected).CompareWith(myComparer);
Assert.That( data, Is.EqualTo(expected).Using(myComparer);
Assert.That( data, Is.EqualTo(expected).UseComparer(myComparer);
Assert.That( data, Is.EqualTo(expected).UseComparer(myComparer);
Assert.That( data, Is.EqualTo(expected).UsingComparer(myComparer);
Assert.That( data,
Is.EqualTo(expected).WhereEqualMeans(myComparer);
Post by Charlie Poole
Post by Charlie Poole
etc.
and
Assert.That(myCollection,
Is.OrderedBy("Key").Comparer(myComparer);
Post by Charlie Poole
Post by Charlie Poole
Assert.That(myCollection,
Is.OrderedBy("Key").CompareWith(myComparer);
Assert.That(myCollection, Is.OrderedBy("Key").Using(myComparer);
Assert.That(myCollection,
Is.OrderedBy("Key").UseComparer(myComparer);
Assert.That(myCollection,
Is.OrderedBy("Key").UsingComparer(myComparer);
'Assert that myCollection is ordered by "Key" using comparer
myComparer'
If forced to choose one for both scenarios my choice would be
"UsingComparer", even though it is not on your original list :)
Post by Charlie Poole
etc.
Currently those are the only two places where this modifier
is used,
Post by Charlie Poole
but I see making more use of it in future. My working
assumption is
Post by Charlie Poole
Post by Charlie Poole
that it will generally be easier for users if we use the
same word in
Post by Charlie Poole
all cases, even though they are technically independent.
Charlie
-----Original Message-----
Sent: Monday, September 08, 2008 10:51 AM
To: Charlie Poole
Subject: Re: [nunit-developer] Key word suggestions?
Charlie could we get a complete line of sourcecode to make
a better
Post by Charlie Poole
judgement..?
Post by Charlie Poole
Hi All,
EqualConstraint takes a modifier "Comparer(IComparer
comparer)", which
Post by Charlie Poole
causes the specified IComparer to be used when testing
for equality.
Post by Charlie Poole
Post by Charlie Poole
This same feature is being added in other constraints, like
OrderedCollectionConstraint.
Before we get too many of them, I want to ask if "Comparer"
is the best way to express this. Other options that
come to mind
Post by Charlie Poole
Post by Charlie Poole
Post by Charlie Poole
are
CompareWith(IComparer)
CompareUsing(IComparer)
UseComparer(IComparer)
Using(IComparer)
...
It's a smallish issue, but I thought I'd ask.
Charlie
---------------------------------------------------------------------
Post by Charlie Poole
Post by Charlie Poole
-
Post by Charlie Poole
--- This SF.Net email is sponsored by the Moblin Your Move
Developer's
Post by Charlie Poole
challenge Build the coolest Linux based applications with
Moblin SDK &
Post by Charlie Poole
win great prizes Grand prize is a trip for two to an Open
Source event
Post by Charlie Poole
anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
nunit-developer mailing list
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
Post by Charlie Poole
& 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
https://lists.sourceforge.net/lists/listinfo/nunit-developer
----------------------------------------------------------------------
Post by Charlie Poole
--- This SF.Net email is sponsored by the Moblin Your Move
Developer's
Post by Charlie Poole
challenge Build the coolest Linux based applications with
Moblin SDK &
Post by Charlie Poole
win great prizes Grand prize is a trip for two to an Open
Source event
Post by Charlie Poole
anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
nunit-developer mailing list
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=/
_______________________________________________
nunit-developer mailing list
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=/
Hans Christian Falkenberg
2008-09-08 21:35:45 UTC
Permalink
Dunno, I didn't even check if CA1716 specifically complains about "using".
I just know that it complains about keyword clashes, which in my
opinion is a valid complaint, because of syntax highlighting
and understandability.

But certainly there are many FxCop violations in .NET libraries,
which is at least part reason of why FxCop was created*

Probably it will complain about List<T>.ForEach as well,
but just because someone has erred in the past doesn't
mean that we shouldn't make attempts to do better in new
libraries :)

+ Hans Christian

*http://blogs.msdn.com/fxcop/archive/2004/01/08/48853.aspx
This is a pretty interesting point. I don't have FxCop, but what does
it say about List<T>.ForEach()?
Thanks
cliff
-----Original Message-----
Behalf Of Charlie Poole
Sent: Monday, September 08, 2008 4:05 PM
To: 'Hans Christian Falkenberg'
Subject: Re: [nunit-developer] Key word suggestions?
Hi Hans Christian,
Post by Hans Christian Falkenberg
Post by Charlie Poole
I'm pretty sure there's no confusion with C# using.
Except in poor syntax highlighters. Which I'm sure there
are at least
Post by Hans Christian Falkenberg
a couple of (think code posted on the web).
FxCop warns against this (CA1716)
http://msdn.microsoft.com/en-us/library/ms182248(VS.80).aspx
Indeed if you look at the MS documentation shipped with
Visual Studio
Post by Hans Christian Falkenberg
for System.Random.Next(), the Visual Basic code example incorrectly
highlights the method as a keyword.
My vote is on UsingComparer because it avoids keywords clashes and
makes it perfectly clear what it is you are using from a glance.
Point taken. I'll not use using. :-)
Charlie
Post by Hans Christian Falkenberg
+ Hans Christian
Post by Charlie Poole
Charlie
-----Original Message-----
Behalf Of
Post by Charlie Poole
Olof Bjarnason
Sent: Monday, September 08, 2008 12:08 PM
To: Charlie Poole
Subject: Re: [nunit-developer] Key word suggestions?
Post by Charlie Poole
Hi Olof,
A good idea... here are two sets using different constraints
Assert.That( data, Is.EqualTo(expected).Comparer(myComparer);
Assert.That( data,
Is.EqualTo(expected).CompareWith(myComparer);
Post by Hans Christian Falkenberg
Post by Charlie Poole
Post by Charlie Poole
Assert.That( data, Is.EqualTo(expected).Using(myComparer);
Assert.That( data,
Is.EqualTo(expected).UseComparer(myComparer);
Post by Hans Christian Falkenberg
Post by Charlie Poole
Assert.That( data, Is.EqualTo(expected).UseComparer(myComparer);
Assert.That( data,
Is.EqualTo(expected).UsingComparer(myComparer);
Post by Hans Christian Falkenberg
Post by Charlie Poole
Assert.That( data,
Is.EqualTo(expected).WhereEqualMeans(myComparer);
Post by Charlie Poole
Post by Charlie Poole
etc.
and
Assert.That(myCollection,
Is.OrderedBy("Key").Comparer(myComparer);
Post by Charlie Poole
Post by Charlie Poole
Assert.That(myCollection,
Is.OrderedBy("Key").CompareWith(myComparer);
Assert.That(myCollection,
Is.OrderedBy("Key").Using(myComparer);
Post by Hans Christian Falkenberg
Post by Charlie Poole
Post by Charlie Poole
Assert.That(myCollection,
Is.OrderedBy("Key").UseComparer(myComparer);
Assert.That(myCollection,
Is.OrderedBy("Key").UsingComparer(myComparer);
'Assert that myCollection is ordered by "Key" using comparer
myComparer'
If forced to choose one for both scenarios my choice would be
"UsingComparer", even though it is not on your original list :)
Post by Charlie Poole
etc.
Currently those are the only two places where this modifier
is used,
Post by Charlie Poole
but I see making more use of it in future. My working
assumption is
Post by Charlie Poole
Post by Charlie Poole
that it will generally be easier for users if we use the
same word in
Post by Charlie Poole
all cases, even though they are technically independent.
Charlie
-----Original Message-----
Sent: Monday, September 08, 2008 10:51 AM
To: Charlie Poole
Subject: Re: [nunit-developer] Key word suggestions?
Charlie could we get a complete line of sourcecode to make
a better
Post by Charlie Poole
judgement..?
Post by Charlie Poole
Hi All,
EqualConstraint takes a modifier "Comparer(IComparer
comparer)", which
Post by Charlie Poole
causes the specified IComparer to be used when testing
for equality.
Post by Charlie Poole
Post by Charlie Poole
This same feature is being added in other constraints, like
OrderedCollectionConstraint.
Before we get too many of them, I want to ask if "Comparer"
is the best way to express this. Other options that
come to mind
Post by Charlie Poole
Post by Charlie Poole
Post by Charlie Poole
are
CompareWith(IComparer)
CompareUsing(IComparer)
UseComparer(IComparer)
Using(IComparer)
...
It's a smallish issue, but I thought I'd ask.
Charlie
---------------------------------------------------------------------
Post by Hans Christian Falkenberg
Post by Charlie Poole
Post by Charlie Poole
-
Post by Charlie Poole
--- This SF.Net email is sponsored by the Moblin Your Move
Developer's
Post by Charlie Poole
challenge Build the coolest Linux based applications with
Moblin SDK &
Post by Charlie Poole
win great prizes Grand prize is a trip for two to an Open
Source event
Post by Charlie Poole
anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
nunit-developer mailing list
https://lists.sourceforge.net/lists/listinfo/nunit-developer
--------------------------------------------------------------
-----------
This SF.Net email is sponsored by the Moblin Your Move
Developer's
Post by Hans Christian Falkenberg
Post by Charlie Poole
challenge Build the coolest Linux based applications with
Moblin SDK
Post by Charlie Poole
& win great prizes Grand prize is a trip for two to an
Open Source
Post by Hans Christian Falkenberg
Post by Charlie Poole
event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
nunit-developer mailing list
https://lists.sourceforge.net/lists/listinfo/nunit-developer
----------------------------------------------------------------------
Post by Hans Christian Falkenberg
Post by Charlie Poole
--- This SF.Net email is sponsored by the Moblin Your Move
Developer's
Post by Charlie Poole
challenge Build the coolest Linux based applications with
Moblin SDK &
Post by Charlie Poole
win great prizes Grand prize is a trip for two to an Open
Source event
Post by Charlie Poole
anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
nunit-developer mailing list
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 &
Post by Hans Christian Falkenberg
win great prizes Grand prize is a trip for two to an Open
Source event
Post by Hans Christian Falkenberg
anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
nunit-developer mailing list
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=/
_______________________________________________
nunit-developer mailing list
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=/
Loading...