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
+2 votes
I'm trying to fake an abstract class and call one its method and it does not work.

the abstract class has a method called : LoadObjectInSession(string key);


I tried the following and each and everytime it returns null ;



var con = Isolate.Fake.AllInstances<BaseController>();

Isolate.WhenCalled(() => con.LoadObjectInSession("myKey")).WillReturn("aaa");


MockObject<BaseController> mockInterface = MockManager.MockObject<BaseController>();


Isolate.WhenCalled(() => mockInterface.Object.LoadObjectInSession("myKey")).WillReturn("aaa");


Please help me understand why everytime it's returning null ?


Thank you
asked by aringan (1.1k points)

Please log in or register to answer this question.