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
0 votes
I tried to use Isolate.Verify to verify the desired execution path across multiple async operations.
It seems that calls made on a thread different than the caller are not detected by Isolator.
Is this a known issue? Are there any workarounds or patches?

Below is a sample code that illustrates the problem (the test fails!):

[TestMethod]
public void Test1()
{
    // Arrange
    //
    var fakeEventsKit = Isolate.Fake.Instance<IReportsRetrievalEventsKit>();           

    // Act
    //
    Action<IReportsRetrievalEventsKit> action = eventsKit => eventsKit.NotifyRetrieveReportCompletedSuccessfully();            
    action.EndInvoke(action.BeginInvoke(fakeEventsKit, null, null));
    
    // Assert
    //
    Isolate.Verify.WasCalledWithAnyArguments(() => fakeEventsKit.NotifyRetrieveReportCompletedSuccessfully());
}

Thanks,
Noam
asked by NoamK (1.1k points)

2 Answers

0 votes
Currently Isolator do not work across threads.

I don't think there si any need to run the test across multiple threads in order to test the functionality of your action.

Instead you can run the action on the same thread and test that the correct action has been taken and passed normally.
answered by dhelper (11.9k points)
0 votes
correction: it does not work across *processes* or *appDomains*. it should absolutely work across threads in the same app domain
answered by royo (2k points)
...