5 Answers, 1 is accepted
Sorry, hit Post by mistake before finishing the message. Looks like there is no edit button so I'll just continue here
The problem is Func1() is actually called, not replaced by the specified Returns(2). It works as expected if I change from internal to public. I couldn't find in documentation that this is limitation of the Free edition, in which case I shd get an error message, like I do with other features supported in Elevated mode only
Thank you for contacting us. For JustMock Lite to know about internal members, you have to set the InternalsVisibleTo key in the project's AssemblyInfo.cs. This is better explained here and the key you have to add is as follows:
Further, after adding the above, you will notice that the test execution doesn't enter the Func2 logic at all and thus, the mock.Func2() call returns 0. This is so, due to the fact you have used a complete mock for the Cls1 class. In order to arrange only the Func1 method and keep the original implementation of Func2, you will have to either apply partial mocking, or use Behavior.CallOriginal(). I hope this helps.
Thanks a lot.
One more question. Is this required only for the Lite version? I know that we have to add InternalsVisibleTo attribute for our assemblies but adding it for "Telerik.JustMock" (along with its Public Key) is required only for Lite version or we have to add it for commercial version too?
The InternalsVisibleTo JustMock entry is needed only when you want to mock internal or non-public members via proxy. In other words, only for the lite version of JustMock, as the commercial will use the profiler for that purpose.