I have a class X and this class have a event: EventX.
And I have a class B, I register event EventX of objectX to a eventhandler HandlerB of class B.
X objectX = X.GetStaticObject();
objectX.EventX += HandlerB;
How to check EventX of objectX contained eventhandler HandlerB. Thanks.
Notes: objectX is a static global which event can be registered from anywhere with any objects which are not object B.
To check that specifically your HandlerB was registered, you can use Delegate.GetInvocationList() method to get appropriate info.
EDIT:
After V4Vendetta comment I tried to compile code and it failed. I slightly changed it.
To be able to do that check, method Test should be added to X (I assume that it’s static, otherwise use this instead of X):
And then test from somewhere where HandlerB is accessible: