I think that this could be done, if Verify method in
Expectation* classes would be changed to (e.g. for
ExpectationValue):
public override void Verify() {
if (this.HasExpectations) {
IPredicate predicate = expectedArg as IPredicate;
// if expectedArg is not an IPredicate, use default
// behavior of IsEqual or IsAnything
if \(predicate == null\) \{
predicate = new IsEqual\(this.\_expectedValue\);
\}
Assertion.Assert\("Value do not equal for object " +
Wrap instance of IsAnything in IsEqual predicate as in:
mockCtrl.Expect("Method", new IsEqual(new IsAnything()));
Since IsAnything does not have a state, you probably need to
compare references. IsEqual uses Object.Equals to evaluate
equality which should work just as you want it.
Regards,
Roman V. Gavrilov
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This is a good idea but we'll have to defer it for a while.
I've got a few other things on my plate. I haven't fully
grokked the static mock stuff yet anyways.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: YES
user_id=397472
Could you be more specific as to this request.
Do you mean using IPredicates in the static part of the library?
Perhaps some pseudo code on what you are trying to do would help.
Griffin
Logged In: YES
user_id=358624
Yes! I was surprised, that IPredicate defined only in
DotNetMock.Dynamic namespace, not in DotNetMock namespace.
It's a very handy thing.
MockDataParameter param = new MockDataParameter();
param.DbType = DbType.String;
param.Value = new DotNetMock.Dynamic.Predicates.IsAnything();
Logged In: YES
user_id=358624
Oops.. Sorry for typo.
I really meant this:
MockDataParameter param = new MockDataParameter();
param.SetExpectedType( DbType.String );
param.SetExpectedValue( new
DotNetMock.Dynamic.Predicates.IsAnything() );
Logged In: YES
user_id=358624
I think that this could be done, if Verify method in
Expectation* classes would be changed to (e.g. for
ExpectationValue):
public override void Verify() {
if (this.HasExpectations) {
IPredicate predicate = expectedArg as IPredicate;
this.name, predicate.Eval(this._actualValue));
}
}
Logged In: YES
user_id=1170022
Wrap instance of IsAnything in IsEqual predicate as in:
mockCtrl.Expect("Method", new IsEqual(new IsAnything()));
Since IsAnything does not have a state, you probably need to
compare references. IsEqual uses Object.Equals to evaluate
equality which should work just as you want it.
Regards,
Roman V. Gavrilov
Logged In: YES
user_id=1023300
This is a good idea but we'll have to defer it for a while.
I've got a few other things on my plate. I haven't fully
grokked the static mock stuff yet anyways.