The class being Mocked looks like this ...
When I attempt to run the test I get ...
> Error Message: Test method
> threw exception: Telerik.JustMock.Core.ElevatedMockingException:
> Cannot mock 'System.String get_Subject()'. The profiler must be
> enabled to mock, arrange or execute the specified target. Stacktrace:
> member) at
> instanceMatcher, MethodBase method) at
> methodMock) at
> expr, Func`1 methodMockFactory) at
> Telerik.JustMock.Mock.<>c__DisplayClass8`1.<Arrange>b__6() at
> guardedAction) at Telerik.JustMock.Mock.Arrange[TResult](Expression`1
> expression) at
Can anyone point out what I've done wrong?
9 Answers, 1 is accepted
It appears that the profiler is not enabled. You should enable the JustMock Profiler from the JustMock menu in Visual Studio.
Please refer to our knowledge base article explaining how to tackle "profiler not enabled" issues.
See What's Next in App Development. Register for TelerikNEXT.
I am afraid that you will not be able to run elevated tests using JustMock nuget package since it deploys the free version. Here is an article which clearly states the differences.
I suppose that you are interested in advanced features that JustMock delivers with commercial version. All these features could be enabled via environment using dedicated variables, please refer to this article to see how exactly. More information about 'registry free profiler' could be also found on MSDN. Since there is no officially existing integration with Rider IDE the only possible way to enable JustMock elevated mode is to use the similar approach like command prompt, i.e. to prepare a small bootstrap batch script which setups the required environment and than launches the IDE. JustMock configuration tool would be available too, for more details please refer to this topic in documentation.
On the latest Justmock version I cannot find the Telerik.JustMock.Tests.dll that I need to run the commands from the article
Also the VS 2017 MsTest.exe file I need is located elsewhere: "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\MSTest.exe"
"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\MSTest.exe" /testcontainer:"C:\Program Files (x86)\Telerik\JustMock\Examples\Telerik.JustMock.Tests\bin\Debug\Telerik.JustMock.Tests.dll"
The examples have evolved to include even more test scenarios and with that, the path was changed. You can open the following folder "C:\Program Files (x86)\Progress\Telerik JustMock\Examples\CSExamples", build the "Telerik.JustMock.CSExamples.VS2019.sln" solution and use the output dll instead.
I will also encourage you to check the JustMock Console article as JustMock Console is a newer and more powerful tool compared to JustMockRunner.
I hope this information answers your questions
Our thoughts here at Progress are with those affected by the outbreak.