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


C# StateMachine.GetNewState方法代码示例

本文整理汇总了C#中StateMachine.GetNewState方法的典型用法代码示例。如果您正苦于以下问题:C# StateMachine.GetNewState方法的具体用法?C# StateMachine.GetNewState怎么用?C# StateMachine.GetNewState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StateMachine的用法示例。


在下文中一共展示了StateMachine.GetNewState方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Constructor_WhenCalled_CopiesTransitionTable

        public void Constructor_WhenCalled_CopiesTransitionTable()
        {
            var transitionTable =
                new List<Transition>
                    {
                        new Transition("Locked", "coin", "Unlocked")
                    };

            var sut = new StateMachine(transitionTable);

            transitionTable.Add(new Transition("Unlocked", "pass", "Locked"));

            Assert.Throws<InvalidOperationException>(
                () => sut.GetNewState("Unlocked", "pass"));
        }
开发者ID:TrueWill,项目名称:FSM.NET,代码行数:15,代码来源:ObjectOrientedFsmTests.cs

示例2: GetNewState_WhenTriggeringEventIsNull_Throws

        public void GetNewState_WhenTriggeringEventIsNull_Throws()
        {
            var sut = new StateMachine(GetTestTransitionTable());

            Assert.Throws<ArgumentNullException>(
                () => sut.GetNewState("Locked", null));
        }
开发者ID:TrueWill,项目名称:FSM.NET,代码行数:7,代码来源:ObjectOrientedFsmTests.cs

示例3: GetNewState_WhenTerminalCurrentState_Throws

        public void GetNewState_WhenTerminalCurrentState_Throws()
        {
            const string TerminalState = "Terminal";
            const string TriggeringEvent = "ev";

            var transitionTable =
                new List<Transition>
                    {
                        new Transition("Whatever", TriggeringEvent, TerminalState)
                    };

            var sut = new StateMachine(transitionTable);

            Assert.Throws<InvalidOperationException>(
                () => sut.GetNewState(TerminalState, TriggeringEvent));
        }
开发者ID:TrueWill,项目名称:FSM.NET,代码行数:16,代码来源:ObjectOrientedFsmTests.cs

示例4: GetNewState_WhenValidArguments_ReturnsNewState

        public void GetNewState_WhenValidArguments_ReturnsNewState(
            string currentState, string triggeringEvent, string expectedNewState)
        {
            var sut = new StateMachine(GetTestTransitionTable());

            string result = sut.GetNewState(currentState, triggeringEvent);

            Assert.Equal(expectedNewState, result);
        }
开发者ID:TrueWill,项目名称:FSM.NET,代码行数:9,代码来源:ObjectOrientedFsmTests.cs

示例5: GetNewState_WhenInvalidEvent_Throws

        public void GetNewState_WhenInvalidEvent_Throws()
        {
            var sut = new StateMachine(GetTestTransitionTable());

            Assert.Throws<InvalidOperationException>(
                () => sut.GetNewState("Locked", "bogus"));
        }
开发者ID:TrueWill,项目名称:FSM.NET,代码行数:7,代码来源:ObjectOrientedFsmTests.cs

示例6: GetNewState_WhenInvalidCurrentState_Throws

        public void GetNewState_WhenInvalidCurrentState_Throws()
        {
            var sut = new StateMachine(GetTestTransitionTable());

            var ex = Assert.Throws<InvalidOperationException>(
                () => sut.GetNewState("Bogus", "coin"));

            Assert.Equal("Invalid state transition: state 'Bogus', event 'coin'.", ex.Message);
        }
开发者ID:TrueWill,项目名称:FSM.NET,代码行数:9,代码来源:ObjectOrientedFsmTests.cs

示例7: GetNewState_WhenCurrentStateIsNull_Throws

        public void GetNewState_WhenCurrentStateIsNull_Throws()
        {
            var sut = new StateMachine(GetTestTransitionTable());

            Assert.Throws<ArgumentNullException>(
                () => sut.GetNewState(null, "coin"));
        }
开发者ID:TrueWill,项目名称:FSM.NET,代码行数:7,代码来源:ObjectOrientedFsmTests.cs


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