c# - How can I trigger an event of a (sealed) Windows Form Component programmatically? -


To be even more specific: I want a unit test that says SaveFileDialog FileOk Trigger the event even if my own code (which wraps SFD and does some extra things before and after Shodialology) is working as intended.

Thanks for any help on this. The problem is that incidents do not show the "lifting" operation - they "subscribe" and

Unsubscribe "Cancel Membership." It depends on the implementation of how they subscribe / cancel the subscription.

However, in the case of SaveFileDialog (or any FileDialog ) A safe method that will increase the event. You can either get from safe dialog and expose a public method that will call OnFileOk or by using the reflection OnFileOk Call it will then call the event handler for FileOk I'm not sure that I especially like any of the attack plans, but without much information what you try to do I am thinking that I am questioning In fact, NET has the idea of ​​"lifting" part of an event, so the EventInfo.GetRaiseMethod . However, this one event goes against the general idea of ​​the IMO, and the C # compiler does not produce the resulting part. I do not believe that general libraries have usually exposed it.


Comments