Integration with Visual Studio Enterprise Code Coverage does not work if the project refers Microsoft.NET.Test.Sdk package version 16.3 (and above). The test run fails with exception:
Telerik.JustMock.Core.ElevatedMockingException : Cannot mock '<type to mock goes here>'. The profiler must be enabled to mock, arrange or execute the specified target.
Detected active third-party profilers:
* C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Team Tools\Dynamic Code Coverage Tools\amd64\covrun64.dll (from process environment)
Disable the profilers or link them from the JustMock configuration utility. Restart the test runner and, if necessary, Visual Studio after linking.
The internal (non-public) events are not handled properly by JustMock, there is no indication for error, Raise arrangement simply does not working as expected. The following sample reproduces the issue:
namespace TestExample
{
public class ClassWithEvents
{
internal event EventHandler<EventArgs> InternalEventToTest;
}
[TestClass()]
public class EventTests
{
[TestMethod]
public void ClassWithEvents_InternalEventTest()
{
//Arrange
bool eventRaised = false;
ClassWithEvents classWithEvents = Mock.Create<ClassWithEvents>();
classWithEvents.InternalEventToTest += (object sender, EventArgs e) =>
{
eventRaised = true;
};
// Act
Mock.Raise(() => classWithEvents.InternalEventToTest += null, new EventArgs());
// Assert
Assert.IsTrue(eventRaised);
}
}
}
I am unable to debug my unit test .NET project. I keep getting several of these errors, and it is super slow as code tries to execute every line. I have rebooted and restarted VS 2019 several times, reinstalled JustMock but the error won't go away.
Visual Studio Output windows shows following repeated errors:
Exception thrown calling IDebugWindowPlugin plugin: System.NullReferenceException: Object reference not set to an instance of an object.
at Telerik.JustMock.Plugins.ObjectInfo.FromObject(Object value)The issue is present when JustMock extension is installed and the debugger is launched inside unrelated projects, for example, a blank console app. The extension should detect JustMock references from project settings and automatically disable this feature when it becomes inapplicable. Optionally the extension could give the way to explicitly disable the debug window from popping up by toggling the menu item.
Currently, the support for code coverage in the JustMock Azure Pipeline task includes only projects targeting .NET Framework.
Implement support for projects targeting .NET Core.
Docker is a container acting like an isolated environment. Research how the JustMock profiler can be registered into such container. Hosted VSTS should work on the same principle. Research how the registry could be accessed through VSTS extension or other tools.
Hi
When enabling JUSTMOCK Profiler it stops a MS rdlc report to render.
I have attached a simple sample demonstrating the error.
The error that the render gives back is the following.
The definition of this report is not valid or supported by this version of Reporting Services. The report definition may have been created with a later version of Reporting Services, or contain content that is not well-formed or not valid based on Reporting Services schemas. Details: Deserialization failed: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) Line 2, position 2.
I have tried to different target version of the .NET framework 4.5.2; 4.6.2, different platform targets "ANY,x86,x64", different VS IDE "2012, 2015", different Microsoft.ReportViewer.WinForm ver. 11,12,14
<DataCollector friendlyName="Code Coverage Wrapper">
<Configuration>
<SinkDataCollector friendlyName="Code Coverage" IsLinked="true" />
</Configuration>
</DataCollector>
Hello,
According to the JustMock documentation, to validate a method on the mock was called it should be done like so:
[TestMethod]
public void ShouldThrowExceptionWhenMustBeCalledSetupIsNeverInvoked()
{
// Arrange
var foo = new Foo();
Mock.Arrange(() => foo.Execute()).MustBeCalled();
// Assert
Assert.Throws<AssertFailedException>(() => Mock.Assert(foo));
}
When I do that, the application fails to compile saying the type AssertFailedException does not exist, even though I have the using statement for the Telerik.JustMock assembly at the top of my file. If I try to fully qualify it like so:
Assert.Throws<Telerik.JustMock.Xunit.AssertFailedException>
I get the same message for the "Xunit" namespace.
I know that the type should exist since when I run the test asserting a different type of Exception, the test fails saying it expects an exception of type Telerik.JustMock.Xunit.AssertFailedException.
I am attaching a couple of images that illustrate the problem.
Thank you.