How to use Moq to unit test method which has Func as parameter
<p>My static method is following. The problem is that my code is not injecting object/class implementing interface, but it uses Func as method parameter. How to mock it with Moq?</p>

<pre><code>public class Repeater
    {
        const int NumberOfReapetsWithException = 5;

        public static async Task&lt;string&gt; RunCommandWithException(Func&lt;string, Task&lt;string&gt;&gt; function, string parameter,
             ILoggerService logger = null, string messageWhileException = "Exception while calling method for the {2} time", bool doRepeatCalls = false)
        {
            int counter = 0;
            var result = "";

            for (; true; )
            {
                try
                {
                    result = await function(parameter);
                    break;
                }
                catch (Exception e)
                {
                    if (doRepeatCalls)
                    {
                        string message = HandleException&lt;string, string&gt;(parameter, null, logger, messageWhileException, ref counter, e);

                        if (counter &gt; NumberOfReapetsWithException)
                        {
                            throw;
                        }
                    }
                    else
                    {
                        throw;
                    }
                }
            }
            return result;
        }
...
}   }
</code></pre>