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 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

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.

- A
asked by ashwin.seshadri (1.1k points)

1 Answer

0 votes
Please find the reply int the following post:
answered by alex (17k points)