I have a class, which has a private async method, which has a local function, like the following example
internal class TestClass
{
......
private async Task<bool> TestPrivateMethod()
{
var x = await TestLocalFunction();
return x;
async Task<bool> TestLocalFunction()
{
await Task.Delay(5);
return true;
}
}
When I try to mock the local function, thows an error "System.MissingMemberException : C# 7 local function 'TestLocalFunction' with the given signature was not found inside method 'TestPrivateMethod'"
var testClassInstance = Mock.Create<TestClass>(Behavior.CallOriginal);
Mock.Local.Function.Arrange<Task<bool>>(testClassInstance, "TestPrivateMethod", "TestLocalFunction").Returns(Task.FromResult(true));