コード例 #1
0
ファイル: StateTest.cs プロジェクト: rinavin/RCJS
        public void IdTest()
        {
            object identifier = new Object();
            State  target     = StateArtifactsFactories.CreateState(identifier);

            Assert.AreEqual(identifier, target.Id);
        }
コード例 #2
0
ファイル: StateTest.cs プロジェクト: rinavin/RCJS
        public void LeaveTest()
        {
            State target      = StateArtifactsFactories.CreateState("abcd");
            var   transitions = StateArtifactsFactories.CreateTransitionList("a", "b", "c");

            foreach (var t in transitions)
            {
                t.AddTrigger(StateArtifactsFactories.CreateTrigger());
            }
            target.AddTransitions(transitions);

            target.DefaultTransition = StateArtifactsFactories.CreateTransition("d");

            target.Leave();
            Assert.IsTrue(((TestState)target).OnLeaveInvoked, "OnLeave was not called");
            foreach (TestTransition t in transitions)
            {
                Assert.IsTrue(t.CleanupInvoked, "Cleanup was not called for {0}", t);
            }
        }
コード例 #3
0
ファイル: StateTest.cs プロジェクト: rinavin/RCJS
        public void EnterTest()
        {
            State target = StateArtifactsFactories.CreateState("abcd");

            Assert.IsNotNull(target.Transitions);
            var transitions = StateArtifactsFactories.CreateTransitionList("a", "b", "c");

            foreach (var t in transitions)
            {
                t.AddTrigger(StateArtifactsFactories.CreateTrigger());
            }
            target.AddTransitions(transitions);

            target.DefaultTransition = StateArtifactsFactories.CreateTransition("d");

            target.Enter();
            Assert.IsTrue(((TestState)target).OnEnterInvoked, "OnEnter was not called");
            foreach (TestTransition t in transitions)
            {
                Assert.IsTrue(t.SetupInvoked, "Setup was not called for {0}", t);
            }
        }