单元测试中的问题ExecutedRoutedEventArgs参数 [英] Problem in Unit Testing ExecutedRoutedEventArgs Argument
问题描述
我在单元测试中面临问题ExecutedRoutedEventArgs Argument。
I facing problem in Unit Testing ExecutedRoutedEventArgs Argument.
static private void test(object sender, ExecutedRoutedEventArgs e)
{
MessageBox.Show("Welcome");
e.Handled = true;
}
我使用Reflection来测试但是我遇到问题 e.Handled = true;
I use Reflection to Test but I facing problem in e.Handled = true;
查看在我使用的代码下面。
See the Below Code which I Used.
var method = typeof(ClassName).GetMethod("test", BindingFlags.Static | BindingFlags.NonPublic);
method.Invoke(null, new object[] { null, null });
问题陈述或我遇到的错误。
Problem Statement or Error Which I am Facing.
如何将值传递给ExecutedRoutedEventArgs。
How Do I Pass Value to ExecutedRoutedEventArgs .
e.Handled'e.Handled'引发了类型'的异常' System.NullReferenceException'
e.Handled 'e.Handled' threw an exception of type 'System.NullReferenceException'
推荐答案
嗨朋友,
欢迎来到MSND论坛。
Welcome to MSND forum.
请阅读本文,其中仅演示了更多内容细节和具体原因
NullReferenceException :
Please read this article which just demonstrates more details and specific causes a NullReferenceException:
https://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-and-how-do-i-fix-it
希望有所帮助。
Hope it helps.
祝你好运,
Best regards,
Fletcher
这篇关于单元测试中的问题ExecutedRoutedEventArgs参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!