I'm unable to get JustMock working with NUnit and OpenCover. JustMock works just fine without OpenCover in the mix, and OpenCover works fine without a JustMock test involved.
I'm explicitly setting all the environment variables
JUSTMOCK_INSTANCE=1
COR_ENABLE_PROFILING=1
COR_PROFILER={B7ABE522-A68F-44F2-925B-81E7488E9EC0}
And invoking OpenCover as a Batch Command
c:\tools\OpenCover\OpenCover.Console.exe -target:"C:\tools\NUnit\nunit-console\nunit3-console.exe" -targetargs:"%WORKSPACE%\Dev\Source\<
snipped
>.dll --result:Results.xml;format=nunit2" -filter:"+[*]* -[*.Tests]*" -register:user -output:Coverage.xml -hideskipped:All -skipautoprops
Both OpenCover and JustMock are installed. The OpenCover dlls are registered and linked to JustMock (see attached screenshot). There is one unit test that uses JustMock to mock System.DateTimeOffset
I get the following when I try to run the setup.
Executing: C:\tools\NUnit\nunit-console\nunit3-console.exe
NUnit Console Runner 3.2.1
Copyright (C) 2016 Charlie Poole
Runtime Environment
OS Version: Microsoft Windows NT 6.1.7601 Service Pack 1
CLR Version: 4.0.30319.42000
Test Files
c:\workspace\Tests\bin\Debug\Tests.dll
Errors and Failures
1) Error : Tests.InitializesWithCurrentTime
Telerik.JustMock.Core.ElevatedMockingException : Cannot mock 'System.DateTimeOffset'. The profiler must be enabled to mock, arrange or execute the specified target.
Detected active third-party profilers:
* (from process environment)
Disable the profilers or link them from the JustMock configuration utility. Rest
art the test runner and, if necessary, Visual Studio after linking.
at Telerik.JustMock.Core.ProfilerInterceptor.ThrowElevatedMockingException(Me
mberInfo member)
at Telerik.JustMock.Core.MocksRepository.InterceptStatics(Type type, IEnumera
ble`1 mixins, IEnumerable`1 supplementaryBehaviors, IEnumerable`1 fallbackBehavi
ors, Boolean mockStaticConstructor)
at Telerik.JustMock.MockBuilder.InterceptStatics(MocksRepository repository,
Type type, Nullable`1 behavior, Boolean mockStaticConstructor)
at Telerik.JustMock.Core.MocksRepository.ConvertExpressionToCallPattern(Expre
ssion expr, CallPattern callPattern)
at Telerik.JustMock.Core.MocksRepository.Arrange[TMethodMock](Expression expr
, Func`1 methodMockFactory)
at Telerik.JustMock.Mock.<>c__DisplayClass8`1.<
Arrange
>b__6()
at Telerik.JustMock.Core.ProfilerInterceptor.GuardInternal[T](Func`1 guardedA
ction)
at Telerik.JustMock.Mock.Arrange[TResult](Expression`1 expression)
Versions
- NUnit 3.2.1
- OpenCover 4.6.519.0
- JustMock 2016.2.426.1