Try following the error message instructions and putting the out parameter in a variable.
var builder = new StringBuilder();
mock.Verify(x => x.Method("String", out builder), Times.Once);
Here is a full example that passes when tested.
[TestClass]
public class ExampleTest {
public interface IInterface {
void Method(string p, out StringBuilder builder);
}
public class MyClass {
private IInterface p;
public MyClass(IInterface p) {
this.p = p;
}
public void Act() {
var builder = new StringBuilder();
p.Method("String", out builder);
}
}
[TestMethod]
public void Should_Ignore_Out() {
//Arrange
var mock = new Mock<IInterface>();
var sut = new MyClass(mock.Object);
//Act
sut.Act();
//Assert
var builder = new StringBuilder();
mock.Verify(x => x.Method("String", out builder), Times.Once);
}
}