My question is: How can I test if an ICommand's executed method was called on a fake item?
I am using the following code:
var mockOperandVM = new fake & lt; UCOperandViewModel & gt; (); MockOperandVM.Setup (x = & gt; x.EditCommand). Returns (new relay commands string> (x => {}}); Var toolbartrave = new UCTibelbar treewim model (mockComponentsLocator.Object); Toolbarrevum Edit Commands Ekkeute ("edit"); MockOperandVM.Verify (x => x.EditCommand.Execute ("edit"), "Editing object with edit parameter was not executed on counterfeit object."); I must specify here that I also have an EditCommand ICommand on the Yekopor and View model and I want to test whether Icmod calls on EditCommand. Press on the toolbar. I get an argument argument on the call to verify it says that "a mail constructor for the given arguments was not found on the neglected type."
Thanks in advance.
Injection in service - preferably using constructor injection . With this, you can type unit test code like this: new copy = new copy & lt; IService & gt; (); Var sut = new MyViewModel (mock.Object); Sut.SomeCommand.Execute (zero); fake. Verify (s = & gt; s.Foo ()); uses this example.
Comments
Post a Comment