本文整理汇总了C#中StateMachine.AvailableStates方法的典型用法代码示例。如果您正苦于以下问题:C# StateMachine.AvailableStates方法的具体用法?C# StateMachine.AvailableStates怎么用?C# StateMachine.AvailableStates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StateMachine
的用法示例。
在下文中一共展示了StateMachine.AvailableStates方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StateMachine_AvailableStates_ModelStateNotState_ThrowInvalidStateModel
public void StateMachine_AvailableStates_ModelStateNotState_ThrowInvalidStateModel()
{
var model = new StubStateModel();
var machine = new StateMachine<StubStateModel>();
Assert.Throws<InvalidStateModelException>(() =>
machine.AvailableStates(model));
}
示例2: StateMachine_AvailableStates_ConcatsModelsTransWithGlobal_ReturnsDistinctStatesByName
public void StateMachine_AvailableStates_ConcatsModelsTransWithGlobal_ReturnsDistinctStatesByName()
{
var model = new StubStateModel();
var machine = new StateMachine<StubStateModel>();
var trigger1 = new Trigger("t1");
var trigger2 = new Trigger("t2");
var state1 = new State<StubStateModel>("s1");
var state2 = new State<StubStateModel>("s2");
var state3 = new State<StubStateModel>("s3");
var state4 = new State<StubStateModel>("s4");
var statetrans3 = new Transition<StubStateModel>(trigger2, state1, state3);
var statetrans1 = new Transition<StubStateModel>(trigger1, state1, state2);
var statetrans2 = new Transition<StubStateModel>(trigger1, state1, state3);
var globaltrans1 = new Transition<StubStateModel>(trigger2, null, state1);
machine.AddGlobalTransition(globaltrans1);
state1.AddTransition(statetrans1);
state1.AddTransition(statetrans2);
state1.AddTransition(statetrans3);
model.CurrentState = state1;
var result = machine.AvailableStates(model);
Assert.Equal(3, result.Count());
Assert.Equal(state1, result.ToList()[0]);
Assert.Equal(state2, result.ToList()[1]);
Assert.Equal(state3, result.ToList()[2]);
}