예제 #1
0
        private Fsm.State AssertOriginalFsm(Fsm.FiniteStateMachine fsm, ISynchronizationContext context)
        {
            Assert.AreSame(fsm, this.fsm);
            Assert.AreEqual(3, fsm.States.Count);
            Assert.AreEqual(4, fsm.Transitions.Count);

            var s1 = fsm.States.Where(s => s.IsStartState).FirstOrDefault();
            var s2 = fsm.States.Where(s => !s.IsStartState && !s.IsEndState).FirstOrDefault();
            var s3 = fsm.States.Where(s => s.IsEndState);

            Assert.IsNotNull(s1);
            Assert.IsNotNull(s2);
            Assert.IsNotNull(s3);

            var t1 = s1.Transitions.FirstOrDefault(t => t.Input == "a");
            var t2 = s2.Transitions.FirstOrDefault(t => t.Input == "a");
            var t3 = s2.Transitions.FirstOrDefault(t => t.Input == "b");
            var t4 = s1.Transitions.FirstOrDefault(t => t.Input == "b");

            Assert.IsNotNull(t1);
            Assert.IsNotNull(t2);
            Assert.IsNotNull(t3);
            Assert.IsNotNull(t4);

            return(s1);
        }
예제 #2
0
 private Fsm.State AssertEmptyFsm(Fsm.FiniteStateMachine fsm)
 {
     Assert.AreSame(fsm, this.fsm);
     Assert.AreEqual(0, fsm.States.Count);
     Assert.AreEqual(0, fsm.Transitions.Count);
     return(null);
 }
예제 #3
0
        private Fsm.State AssertPetriNetLikeFsm(Fsm.FiniteStateMachine fsm, ISynchronizationContext context)
        {
            Assert.AreSame(fsm, this.fsm);
            Assert.AreEqual(3, fsm.States.Count);
            Assert.AreEqual(2, fsm.Transitions.Count);

            var s1 = fsm.States.FirstOrDefault(s => s.Name == "s1");
            var s2 = fsm.States.FirstOrDefault(s => s.Name == "s2");
            var s4 = fsm.States.FirstOrDefault(s => s.Name == "s4");

            Assert.IsNotNull(s1);
            Assert.IsNotNull(s2);
            Assert.IsNotNull(s4);

            return(s1);
        }