I have a class that constructs a new object to add to the internal state of an object I am mocking... something like
public class foo
{
public bar raz;
public foo(bar raz)
{
this.raz = raz;
}
public void InsertItem()
{
raz.Insert(new FooBar());
}
}
I want to mock raz, but can't figure out the syntax to say verify raz.Insert was called, but it doesn't need to match the argument passed (since its created internally). What can I do?
var mock = new Mock<bar>();
mock.Setup(mock => mock.Insert(?)).Verifiable(); //This is the line I can't figure out
var test(mock.Object);
test.InsertItem();
mock.VerifyAll();