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 Answers. Here you can ask and receive answers from other community members. And if you liked or disliked an answer or thread: react with an up- or downvote Enjoy!
0 votes
Hi,
I am using typemock 7.3.2. I recently converted a synchronous library methods to asynchronous and tried to convert the corresponding unit tests as well. I was trying to do the following

[Test]
public async void TestLibraryMethodMakingTwoServiceCalls()
{
var library = CreateLibrary();
var service = library.Service;

var method1response = new Method1Response();

Isolate.WhenCalled(() => service.Method1(null, null)).WillReturn(method1response);

var method2response = new Method2Response();

Isolate.WhenCalled(() => service.Method2(null, null, null)).WillReturn(method2response);

var result = await library.GetResultAsync(); // GetResultAsync will call Method1 and then method2

Isolate.Verify.WasCalledWithAnyArguments(() => service.Method2(null, null, null));
}

This is not working due to the fact that when the library method is called asynchronously, the intercepts don't seem to work and the original service method1 is invoked and it fails due to lack of input. Is there any support in Isolator for async/await pattern? If so, kindly let me know.

Thanks
- A
asked by (6.1k points)

1 Answer

0 votes
Please find the reply int the following post:
https://www.typemock.com/answers/11483/?show=18537#a18537
answered by (18k points)
...