I am trying to run NUnit with Moles and I am getting a weird error and I am not quite sure why.
[Test]
[Moled]
public void SendEmail_Test()
{
SIEmailService emailService = new SIEmailService
{
SendMailStringStringString = (email, subject, body) => { }
};
SIServiceLocator serviceLocator = new SIServiceLocator();
serviceLocator.GetInstance(() => emailService);
MLocatorFactory.GetInstance = (() => serviceLocator);
IEmailservice = new EmailService();
service.SendEmail("[email protected]", null, null, null, DateTime.Now, null);
}
Error:
Any suggestions on how to fix this partially trusted caller issue???? Many thanks.
Add to your tests assembly AllowPartiallyTrustedCallersAttribute. But I am not sure why it requires this. May be you are running your tests from network share?