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