refactored event dispatcher tests and support utility