我正在为WinRT应用程序编写单元测试,并且我能够使用以下方法调用非异步私有方法:
TheObjectClass theObject = new TheObjectClass();
Type objType = typeof(TheObjectClass);
objType.GetTypeInfo()
.GetDeclaredMethod("ThePrivateMethod")
.Invoke(theObject, null);
Run Code Online (Sandbox Code Playgroud)
但是,如果有问题的私有方法是async,代码将继续执行而不等待它完成.
如何await为此添加功能?