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
AddressObject newAddress = new AddressObject() { StreetAddress = "123 Main Street", ZipCode = "66204" };

Isolate.WhenCalled( () => mockUseCase.CreateAddressObject( "123 Main Street", "66204", out newAddress ) ).WithExactArguments().WillReturn( UseCaseStatus.Success );

Why, oh why does newAddress come back as NULL when I'm stepping through my code?

I want to have WithExactArguments **and** an out parameter that I can populate. How do I do that, please?
asked by jasongb (1.5k points)

13 Answers

0 votes
Unfortunately, not yet. We are slating this bug fix to an upcoming release, and it's high on our to-fix list. We'll update here and in release notes when it's out.
answered by doron (17.2k points)
0 votes
I was reviewing our code while making another test that I want to use when training my colleagues on Typemock Isolator.

I realized when I stepped through the code that arguments didn't matter when I used .DoInstead.

I'd like to use .WithExactArguments so there's no risk of ambiguity, etc.

But when I add .WithExactArguments, my test fails - even though I'm handing in those exact arguments.

So can I use .WithExactArguments at all with out parameters?
answered by jasongb (1.5k points)
0 votes
The bug in question shows up only when using a WhenCalled WithExactParameters on a function that has an out parameter, on an object that was faked from an interface.

This bug will be fixed today or tommorow - in the meanwhile as a workaround you can fake the object from a class.

i.e. in the code you sent us,

replace the line: instance = Isolate.Fake.Instance<IMyAddressUseCase>();
with the line: instance = Isolate.Fake.Instance<MyAddressUseCase>();
answered by yoel (1.9k points)