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