Updated unit test code to support improved event handling