Reputation: 858
Please suggest how to mock the dialog box of the following type inside the unit test using moq.
void ShowDialog(string windowName, string parentWindowName,
Dictionary<string, object> inputFields,
Action<Dictionary<string, object>> closeCallBack,
Dictionary<string, object> windowProperties = null);
I have tried the following thing but its not working :
UIServicemock.Setup(u => u.ShowDialog(It.IsAny<string>, It.IsAny<string>,
It.IsAny<Dictionary<string,object>>,
It.IsAny<Action<Dictionary<string, object>>>,
It.IsAny<Dictionary<string,object>>));
I think I am missing the syntax.
Upvotes: 3
Views: 2121
Reputation: 7705
The It.IsAny<T>()
call is a method so needs parentheses after it:
UIServicemock.Setup(u => u.ShowDialog(It.IsAny<string>(), It.IsAny<string>(),
It.IsAny<Dictionary<string,object>>(),
It.IsAny<Action<Dictionary<string, object>>>(),
It.IsAny<Dictionary<string,object>>()));
Upvotes: 3