Hi,
I have a MessageBox.Show method, which has a CallBack action associated with it. I want to Pass a Mocked parameter to that action, which would eventually execute the action statements based on Parameter passed.
Action<DialogResult> callback = (result) => { if (result == DialogResult.Yes) { //Do something here } };MessageBox.Show("Are you Sure?","Test App",DialogButton.YesNo, DialogImage.Question,callback);I tried something like below, but it did not work.
Mock.Arrange(() => dialog.Show(Arg.AnyString, Arg.AnyString,DialogButton.YesNo, DialogImage.Question, Arg.IsAny<Action<DialogResult>>())). DoInstead((Action<DialogResult> action) => { action.Invoke(DialogResult.Yes); });I want to execute the Original callback, with a mocked DialogResult.
How can we do that?
Thanks in Advance,
Sagar