I have a RelayCommand Class which implements the ICommand interface and it takes a new Action as the parameter for its constructor. It is pretty basic
For example here is how i use command when a button is clicked. And this code is in the constructor of my ViewModel.
All this code does is opens a FolderBrowserDialog and lets the user select a folder.
OutputSelect = new RelayCommand(new Action<object>(folderSelect));
This is a method in the viewModel class
public void folderSelect(object obj)
{
var dlg = new FolderBrowserDialog();
Nullable<bool> result = dlg.ShowDialog();
if (result == true)
{
// Open document
string filename = dlg.SelectedPath;
_model.OutputFolder = filename;
}
}
Once the button is clicked the method folderSelect is run.
Now I am wondering how do I unit test this feature of my Application?
Do i make a Mock for a Action and pass that into my viewModel.OutputSelect.Execute()?