In this question, I found an this answer that seems to be the best way to solve the problem to me.
The provided code assumes that the function that is mocked returns a value:
bool SomeFunc(out ISomeObject o);
However, the object I want to mock has an out function as follows:
void SomeFunc(out ISomeObject o);
The relevant code fragment from the mentioned answer:
public delegate void OutAction<TOut>(out TOut outVal);
public static IReturnsThrows<TMock, TReturn> OutCallback<TMock, TReturn, TOut>(
this ICallback<TMock, TReturn> mock, OutAction<TOut> action)
where TMock : class
{
// ...
}
Void is not a valid type for TReturn. So I believe I would have to somehow adapt this code to get it to work with methods returning void. But how?