public void Can_transition_between_states() { using (new StateProviderFixture()) { StateProvider.Setup <ThreeValidStaticStates>(); var data = new ThreeValidStatesData(); var actor = new ThreeValidStaticStates(); actor.SetState <ThreeValidStaticStates.StateA>(data); actor.SetState <ThreeValidStaticStates.StateB>(data); actor.SetState <ThreeValidStaticStates.StateC>(data); Assert.True(data.BeginStateA); Assert.True(data.EndStateA); Assert.True(data.BeginStateB); Assert.True(data.EndStateB); // last state was C Assert.Equal(typeof(ThreeValidStaticStates.StateC), actor.CurrentState.GetType()); Assert.Equal("ThreeValidStaticStates (StateC)", actor.DisplayName); // all states A and C have names Assert.NotNull(actor.GetState <ThreeValidStaticStates.StateA>().Name); Assert.NotNull(actor.GetState <ThreeValidStaticStates.StateC>().Name); // can lookup state by name Assert.Equal(typeof(ThreeValidStaticStates.StateA), actor.GetStateByName("StateA").GetType()); // can enumerate all states var allStates = StateProvider.GetAllStatesByType <ThreeValidStaticStates>(); Assert.Equal(4, allStates.Count); } }