public void TestTransitionEvents() { int eventCount = 0; FiniteStateMachine <State> fsm = new FiniteStateMachine <State>(); fsm.AddTransition(State.A, State.B); fsm.AddTransition(State.B, State.C); fsm.AddEventOnTransition(State.A, State.B, (from, to) => { Assert.IsTrue(from == State.A); Assert.IsTrue(to == State.B); eventCount++; }); fsm.Start(State.A); Assert.IsTrue(eventCount == 0); fsm.TransitionTo(State.B); Assert.IsTrue(eventCount == 1); fsm.TransitionTo(State.C); Assert.IsTrue(eventCount == 1); }