Ask a Question
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!
TypeMockException - Class inherit from IConvertible having issue using Version8.6
How can I test that an internal property was set with a specific value during a method call
TypeMockException - Cannot convert Enum to Nullable using Version8.6
Null Reference Error When Trying To Unit Test Code Setting
Typemock trying to mock File.ReadLines in the buildstep 'Typemock via Visual Studio Test'
Calling A method within an abstract class
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 ?
to add a comment.
to answer this question.
First of all, the second example you presented here is an old API, so I wouldn't recommend using it.
When I tested the first example on my machine it worked fine.
Which Typemock version are you using?
my version : 18.104.22.168
again neither works for me. when it gets to the following line of code :
string result = LoadObjectInSession("myKey");
although expected value for result is "aaa", however it's null
I'm using version 22.214.171.124 and it works fine for me, so I believe that if you use this version it will work for you too.
Do you have a license key? if so, can you send it to us?
to add a comment.