|
From: Steve M. <Ste...@ty...> - 2007-08-16 12:49:06
|
There was some discussion a while ago on this issue. I'm not sure that
it ever got entered as a bug. I've been bit by it when dealing with
'out' parameters (example: With(1,2,Is.Out) fails)
I think that adding the matcher to the list using the coalescing
operator would be pretty readable
The following example is without having a chance to look at the code in
question, so I hope you get the gist
expectations.Add(x as Matcher ?? Is.EqualTo(x))
-----Original Message-----
From: nmo...@li...
[mailto:nmo...@li...] On Behalf Of Mike
Capp
Sent: Thursday, August 16, 2007 5:43 AM
To: nmo...@li...
Subject: [NMock2-Dev] Minor change I'd like to make
Currently, ExpectationBuilder's "With" and friends take either an
array of Matchers or an array of objects which are converted to
EqualMatchers.
The problem with this is that if I have a "With(1, 2, 3, 4, 5)"
expectation and I want to replace the 5 with some other Matcher, I
have to explicitly convert all of the other arguments to explicit
Matchers as well. There's no good reason for this as far as I can see,
and it's a usability regression from NMock1. I'd therefore like to
change this to allow Matchers and non-matchers to be mixed. Matchers
are used as is; non-Matchers are converted to EqualMatchers as they
are today.
The change wouldn't break anything that worked before unless a test
was explicitly expecting Matcher argument values, which isn't likely
to happen and is still expressible via Is.EqualTo(myMatcher) if it
does.
I appreciate that "if (x is Matcher) {} else {}" has an odour to it,
but I don't think that in itself justifies throwing the user off a
convenience cliff in this case.
Any objections?
Mike
------------------------------------------------------------------------
-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NMock-two-dev mailing list
NMo...@li...
https://lists.sourceforge.net/lists/listinfo/nmock-two-dev
|