当前位置: 首页>>代码示例>>C#>>正文


C# StateMachine.GlobalTransitionsOn方法代码示例

本文整理汇总了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]);
        }
开发者ID:mmonteleone,项目名称:nate,代码行数:16,代码来源:StateMachineTests.cs

示例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());
        }
开发者ID:mmonteleone,项目名称:nate,代码行数:16,代码来源:StateMachineTests.cs

示例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]);
        }
开发者ID:mmonteleone,项目名称:nate,代码行数:18,代码来源:StateMachineTests.cs

示例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());
        }
开发者ID:mmonteleone,项目名称:nate,代码行数:14,代码来源:StateMachineTests.cs

示例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);
        }
开发者ID:mmonteleone,项目名称:nate,代码行数:8,代码来源:StateMachineTests.cs

示例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());
        }
开发者ID:mmonteleone,项目名称:nate,代码行数:11,代码来源:StateMachineTests.cs


注:本文中的StateMachine.GlobalTransitionsOn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。