jeudi 26 mai 2016

With Moq, how can I mock protected methods with out parameter?

For a method like:

protected virtual bool DoSomething(string str) { }

I usually mock it through:

var mockModule = new Mock<MyClass> { CallBase = true };
mockModule.Protected().Setup<bool>("DoSomething", ItExpr.IsAny<string>()).Returns(true);

But for a method like:

protected virtual bool DoSomething(out string str) { }

How can I mock it? Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire