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 having a problem with a chained statement. Here is the code

MediaContentFeed feed = RecorderManager.CreateMockedObject<MediaContentFeed>();
         
         using(RecordExpectations recorder = RecorderManager.StartRecording()){
            recorder.ExpectAndReturn(feed.Game.IsReleased, false);
         }



I get this exception when the ExpectAndReturn statement is executed.

Error   1   TestCase 'GameFly.Retail.UnitTests.Domain.Product.CriticReviewFixture.IsPreviewWhenNotReleased'
failed: TypeMock.TypeMockException: 
*** Mocked return value of MediaContentFeed.get_Game() is unknown, use recorder.Return().
*** Note: Cannot mock types from mscorlib assembly.
   at TypeMock.MethodDecorator.b()
   at TypeMock.MockManager.a(String A_0, String A_1, Object A_2, Object A_3, Boolean A_4, Object[] A_5)
   at TypeMock.InternalMockManager.getReturn(Object that, String typeName, String methodName, Object methodParameters, Boolean isInjected)
   at GameFly.Retail.UnitTests.Domain.Product.CriticReviewFixture.IsPreviewWhenNotReleased() in C:DataProjectsGameFlyRetailMainLineSrcGameFly.Retail.UnitTestsDomainProductCriticReviewFixture.cs:line 66   C:DataProjectsGameFlyRetailMainLineSrcGameFly.Retail.UnitTestsDomainProductCriticReviewFixture.cs   66   


Am I doing something wrong?

Please let me know if I can provide any further information.
asked by juice_johnson (9.8k points)

2 Answers

0 votes
Hi,
Perhaps Game or IsReleased is a field?
( I cannot see the call to IsReleased in the stack trace or error code)
In any case please send the Game and IsReleased code method signitures (a code sample)
answered by scott (32k points)
0 votes
Turns out this error was because I was stepping through the code with the debugger. Works fine when I did not step into the using(recorder) block with the debugger.

Sorry.
answered by juice_johnson (9.8k points)
...