|
From: Steve M. <Ste...@ty...> - 2006-08-18 13:23:39
|
Making Nmock2 a friend assembly would work. You could also have a
conditional compilation flag that made them public when built for
testing purposes. However, I think the value of testing internal
interfaces directly is limited.
________________________________
From: nmo...@li...
[mailto:nmo...@li...] On Behalf Of David
Webster-Jaggard
Sent: Friday, August 18, 2006 8:09 AM
To: nmo...@li...
Subject: [NMock2-Dev] Access is denied on internal interfaces?
=20
I'm upgrading our unit tests to NMock2 and have come across a bit of a
problem. If I try to mock and internal interface I get an access denied
error when I run the test. Here is some example code:
=20
using NMock2;
using NUnit.Framework;
=20
namespace NMock2Test
{
internal interface IInternalInterface
{
void DoNothing();
}
=20
[TestFixture]
public class Class1
{
[Test]
public void Test()
{
Mockery mocks =3D new Mockery();
IInternalInterface mockInterface =3D
mocks.NewMock<IInternalInterface>();
}
}
}
=20
Is there anyway to get around this (maybe make NMock2 a friend assembly,
however you do that..)? I don't want to start making internal interfaces
public.
=20
Thanks
=20
--=20
This message has been scanned for viruses and=20
dangerous content by MailScanner <http://www.mailscanner.info/> , and is
believed to be clean.=20
|