I have an interface that looks like this
IBasePlugin containig....
bool Connect(XmlNode xmlRequest);
I would like to mock this out to return true no matter what request I send in with NSubstitute Here is what my scenario looks like
//[TestFixture]
public class NUnitTest1
{
//[Test]
public void TestMethod1()
{
var b = Substitute.For< IBasePlugin > ();
b.Connect(Arg.Any<XmlNode>())
MyPlugin tester = new MyPlugin(b);
tester.GetAddressList()
}
}
The issue is, I wondered how I would simulate any value passed to Connect. I thought it would be something like what I have but it does not like that any call because by ref return type ref T is not supported. Any input would be great. Thanks.
I figured it out. You can't use the any. Adding Compat was the key. I had to use :
b.Connect( Arg.Compat.Any<XmlNode>()).Returns(true);