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


C# State.TransitionsOn方法代码示例

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

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

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

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

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

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

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


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