chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes
I am using the following to create my fake objects:


One of the methods on one of the classes takes a parameter. Is it possible to ignore all calls to one of the methods, regardless of the parameter value? I don't care what the value is; I just want to ignore the one call. I'm looking to do something like this:

var fakeObject = Isolate.Fake.Instance<Class>(Members.CallOriginal);
Isolate.WhenCalled(() => fakeObject.Method(IDONTCAREWHATVALUEISUSED)).DoInstead(() => { });

Is that possible? I suppose I am looking for the .WithAnyArguments() analogy to the existing .WithExactArguments() clause.
asked by JeffFerguson (3.2k points)

1 Answer

0 votes
That is the default behavior
You can also do this on a real live object. :D

var fakeObject = new Class(); // same as Isolate.Fake.Instance<Class>(Members.CallOriginal);
Isolate.WhenCalled(() => fakeObject.Method(null)).DoInstead(() => { });
answered by scott (32k points)