Test if event handler is registered and triggered when the event happens