Testing framework for Triggers.

Added a way to test when Triggers occur and some test cases.