Hi,
8) See
this topic
mock.ExpectCall("add_Click");
:roll: We already have plans to add event specific API's, but the above will always work.
:idea: If you want to check that the correct EventHandler is passed you could probably test the argument (use
.Args())
and then use the Delegate Method and Target properties to test that the correct event is passed.
:idea: If you want to Change the event handler to a mocked one, you can either mock
buttonTest_Click or you can pass a new event handler and TypeMock will switch the argument before the real method gets it. You will need an Enterprise License and the code will look like this.
mock.ExpectUnmockedCall("add_Click").Args(new Assign(new EventHandler(mockedButton_Click)));
then in the test you can create your own handler