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!

Swap not swapping.

0 votes

Hi all, I'm new to Typemock Isolator, and have a question about something that's not working how I'd expect.

Here is my test:

public async Task myTest()
    Guid surveyRef = Guid.NewGuid();
    Guid userRef = Guid.NewGuid();

    UserSurveyEntity survey = new UserSurveyEntity
        UserSurveyRef = surveyRef,
        UserRef = userRef,
        UserSurveyResults = new List<UserSurveyResultEntity>(),
        UserAnswers = new List<UserAnswerEntity>()


    // Act 
    var result = await Api.Calculate(surveyRef);


and the method I'm testing:


public async Task<decimal> Calculate(Guid userSurveyRef)
    using (DBEntitiesAccessor accessor = new DBEntitiesAccessor())
        UserSurveyEntity survey1;

        // get the survey from the db
        UserSurveyEntity survey = await accessor.DataContext.UserSurveyEntities.Where(...).SingleOrDefaultAsync();



However, neither survey nor survey1 are replaced with my mocked value.

Any pointers?



PS, I was running this synchronously using 

var result = Api.Calculate(surveyRef).Result;

I had the same issue, so I thought I'd try it async to see if it fixed it. It didn't, but now, after running it once async, I've also lost the little shield icon next to the test method, so I can't test it asynchronously any more. Is that normal?


asked Aug 10, 2016 by fb6668 (3,100 points)
No clues anyone?

1 Answer

0 votes


No, it's not normal.

Please run Visual Studio with logs and send it to us (
- Open Developer Command Prompt for VS
- Run the following command: devenv /Log
- Open any solution
- Find ActivityLog.xml file. By default it's in "userAppDataRoamingMicrosoftVisualStudioversion_number"


answered Aug 22, 2016 by eva (1,580 points)