Sorry if this is a noob question on JustMock, but I'm still learning the package.
VS 2017 Enterprise 15.2(26430.6) Release
.NET Framework 4.6.01586
XUnit.net 2.2.0
JustMock 2017.2.502.1
Created a unit test for testing an email module where I'm mocking the SmtpClient to keep it from actually sending emails in unit tests. When I run the tests either all together or individually, they run properly. When I attempt to use the Test->Analyze Code Coverage, several of them fail with:
Message: Telerik.JustMock.Core.ElevatedMockingException : Cannot mock
'Void Send(System.Net.Mail.MailMessage)'
. The profiler must be enabled to mock, arrange or execute the specified target.
Detected active third-party profilers:
* {9317ae81-bcd8-47b7-aaa1-a28062e41c71} (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.
I've tried some of the suggestions I've found in other forum topics like disabling Intellitrace, running VS elevated and enabling the VS2015 Intellitrace option in the JustMock Options menu. None of these combinations appear to make any difference. As it is, I'm unable to view code coverage using these unit tests which limits the usability.
Here's the code that passes except under Analyze Code Coverage:
var log = Mock.Create<ILog>();
Mock.Arrange(() => log.InfoFormat(EMailModule.Properties.Resources.Email_Send_log_SendingMessage,
_validSubject)).OccursAtLeast(1);
var smtpClient = Mock.Create<SmtpClient>(Behavior.CallOriginal);
Mock.Arrange(() => smtpClient.Send(Arg.IsAny<MailMessage>()))
.IgnoreArguments()
.IgnoreInstance()
.DoNothing()
.OccursOnce();
var mail =
new
Email(log, _testSMTPServer);
mail.Sender =
new
MailAddress(_validSender);
mail.EmailAddressesTo.Add(
new
MailAddress(_validEmail));
mail.Subject = _validSubject;
mail.Send();
Mock.Assert(smtpClient);
Mock.Assert(log);
Anyone have any suggestions? Is this a bug, a known issue with VS2017 and JustMock or just me being too new to JustMock a.k.a.I screwed something up?