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
After installing the latest version 4.2.4 of Isolator, I started getting failures with chained expectations. This is the code of a previous passing test:

ContentGateway gateway = new ContentGateway();
IBaseMediaTitle title = RecorderManager.CreateMockedObject<IBaseMediaTitle>();

         using (RecordExpectations recorder = RecorderManager.StartRecording()) {            recorder.ExpectAndReturn(title.Rating.HasMatureContent, true);         }

         Assert.AreEqual(ContentAuthorizationStatus.UnauthorizedByAge, gateway.AuthorizeContent(title));


after install the new version i get this error

Test method GameFly.Retail.UnitTests.Application.ContentGatewayFixture.AuthorizationForNonMatureContent threw exception:  TypeMock.TypeMockException: 
*** Cannot return a value for ContentRating.get_HasMatureContent() because no value was set. use recorder.Return().
*** Note: Cannot mock types from mscorlib assembly..


Changing the code to split up the chain like this


ContentGateway gateway = new ContentGateway;
         IBaseMediaTitle title = RecorderManager.CreateMockedObject<IBaseMediaTitle>();
         ContentRating rating = RecorderManager.CreateMockedObject<ContentRating>();

         using (RecordExpectations recorder = RecorderManager.StartRecording()) {
            recorder.ExpectAndReturn(rating.HasMatureContent, false);
            recorder.ExpectAndReturn(title.Rating, rating);
         }

         Assert.AreEqual(ContentAuthorizationStatus.Authorized, gateway.AuthorizeContent(title));


fixes the problem.

In the first test, I dont even make it out of the recording block before the failure. Please let me know if you need anymore information to resolve this issue. In the meantime I have rolled back to 4.2.3 and the problems went away.
asked by juice_johnson (9.8k points)

3 Answers

0 votes
Hi Jesse,

From this simple example, I can't reproduce it here. Let's take it offline, and I'll send a separate email with my requests.

Thanks for helping,
answered by gilz (14.5k points)
0 votes
Hi everyone,

The problem was fixed, and will be available in the next release.
answered by gilz (14.5k points)
0 votes
Hi everyone,

We've just released version 4.3 which fixes this issue. You can download it from https://www.typemock.com/Downloads.php
answered by gilz (14.5k points)
...