I am new to unit testing. How can I pass arguments into the below function
OnDefineInDictCompleted
client.DefineInDictCompleted += new EventHandler&l开发者_开发百科t;DefineInDictCompletedEventArgs>(OnDefineInDictCompleted);
OnDefineInDictCompleted(object sender, DefineInDictCompletedEventArgs e)
Rather than define OnDefineInDictCompleted
as a method how about using anonymous delegates?
var parameterA = 1;
var parameterB = "Foo";
EventHandler<DefineInDictCompletedEventArgs> handler = (s, e) =>
{
//Can access local variables here;
var x = parameterA.ToString() + parameterB;
};
client.DefineInDictCompleted += handler;
精彩评论