本文整理汇总了C#中StateMachine.GlobalTransitionsOn方法的典型用法代码示例。如果您正苦于以下问题:C# StateMachine.GlobalTransitionsOn方法的具体用法?C# StateMachine.GlobalTransitionsOn怎么用?C# StateMachine.GlobalTransitionsOn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StateMachine
的用法示例。
在下文中一共展示了StateMachine.GlobalTransitionsOn方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StateMachine_AddGlobalTransition_TwoValidTranSameTrigger_ReturnsBothWithTransitionsOn
public void StateMachine_AddGlobalTransition_TwoValidTranSameTrigger_ReturnsBothWithTransitionsOn()
{
var machine = new StateMachine<StubStateModel>();
var state2 = new State<StubStateModel>("s2");
var state3 = new State<StubStateModel>("s2");
var trigger1 = new Trigger("t1");
var transition1 = new Transition<StubStateModel>(trigger1, null, state2, m => 1 == 2);
var transition2 = new Transition<StubStateModel>(trigger1, null, state3, m => 1 == 1);
machine.AddGlobalTransition(transition1);
machine.AddGlobalTransition(transition2);
var trans = machine.GlobalTransitionsOn(trigger1).ToList();
Assert.Equal(transition1, trans[0]);
Assert.Equal(transition2, trans[1]);
}
示例2: StateMachine_AddGlobalTransition_TwoValidTranDiffTriggers_ReturnsOneForEachTransitionsOn
public void StateMachine_AddGlobalTransition_TwoValidTranDiffTriggers_ReturnsOneForEachTransitionsOn()
{
var machine = new StateMachine<StubStateModel>();
var state2 = new State<StubStateModel>("s2");
var state3 = new State<StubStateModel>("s2");
var trigger1 = new Trigger("t1");
var trigger2 = new Trigger("t2");
var transition1 = new Transition<StubStateModel>(trigger1, null, state2, m => 1 == 2);
var transition2 = new Transition<StubStateModel>(trigger2, null, state3, m => 1 == 1);
machine.AddGlobalTransition(transition1);
machine.AddGlobalTransition(transition2);
Assert.Same(transition1, machine.GlobalTransitionsOn(trigger1).FirstOrDefault());
Assert.Same(transition2, machine.GlobalTransitionsOn(trigger2).FirstOrDefault());
}
示例3: StateMachine_GlobalTransitionsOn_TriggerMatchingTwoTransitionsNotAnother_ReturnsTwoMatching
public void StateMachine_GlobalTransitionsOn_TriggerMatchingTwoTransitionsNotAnother_ReturnsTwoMatching()
{
var machine = new StateMachine<StubStateModel>();
var state2 = new State<StubStateModel>("s2");
var state3 = new State<StubStateModel>("s2");
var trigger1 = new Trigger("t1");
var transition1 = new Transition<StubStateModel>(trigger1, null, state2, m => 1 == 2);
var transition2 = new Transition<StubStateModel>(trigger1, null, state3, m => 1 == 1);
machine.AddGlobalTransition(transition1);
machine.AddGlobalTransition(transition2);
var result = machine.GlobalTransitionsOn(new Trigger("t1"));
Assert.NotNull(result);
Assert.Equal(2, result.Count());
Assert.Same(transition1, result.ToList()[0]);
Assert.Same(transition2, result.ToList()[1]);
}
示例4: StateMachine_GlobalTransitionsOn_TriggerMatchingOneTransitionNotAnother_ReturnsOnlyMatchingONe
public void StateMachine_GlobalTransitionsOn_TriggerMatchingOneTransitionNotAnother_ReturnsOnlyMatchingONe()
{
var machine = new StateMachine<StubStateModel>();
var state2 = new State<StubStateModel>("s2");
var trigger1 = new Trigger("t1");
var transition1 = new Transition<StubStateModel>(trigger1, null, state2, m => 1 == 2);
machine.AddGlobalTransition(transition1);
var result = machine.GlobalTransitionsOn(new Trigger("t1"));
Assert.NotNull(result);
Assert.Equal(1, result.Count());
Assert.Same(transition1, result.FirstOrDefault());
}
示例5: StateMachine_GlobalTransitionsOn_NewTrigger_NoMatchingTrans_ReturnsEmptyNonNullEnumerable
public void StateMachine_GlobalTransitionsOn_NewTrigger_NoMatchingTrans_ReturnsEmptyNonNullEnumerable()
{
var machine = new StateMachine<StubStateModel>();
var result = machine.GlobalTransitionsOn(new Trigger("sometrigger"));
Assert.NotNull(result);
Assert.Empty(result);
}
示例6: StateMachine_AddGlobalTransition_ValidTran_ReturnsWithTransitionsOnTrigger
public void StateMachine_AddGlobalTransition_ValidTran_ReturnsWithTransitionsOnTrigger()
{
var machine = new StateMachine<StubStateModel>();
var state2 = new State<StubStateModel>("s2");
var trigger1 = new Trigger("t1");
var transition1 = new Transition<StubStateModel>(trigger1, null, state2);
machine.AddGlobalTransition(transition1);
Assert.Same(transition1, machine.GlobalTransitionsOn(trigger1).FirstOrDefault());
}