How can I assemble an event from a mole using MS Moles?

The Moles documentation describes how to create events in classes, but the same method does not work with full Mole. You can add a delegate to the add / remove methods, but you cannot manually raise this event.

The only solution I can think of is to create a RaiseEvent () method for the tested class, but this view hits the point of using moles.

Any suggestions?

+3
source share
1 answer

Turns out you can use the Add method for the event and grab the event handler. When you have an event handler, you can simply call it manually by simulating an event.

+3
source

Source: https://habr.com/ru/post/1773595/


All Articles