Exemplo n.º 1
0
        public void Instantiation()
        {
            // Supply parallel statemachines as List
            var par = new Parallel("par", new List <StateMachine> {
                new StateMachine(),
                new StateMachine()
            });

            Expect(par.id, Is.EqualTo("par"));
            Expect(par, Is.InstanceOf <State>());
            Expect(par, Is.InstanceOf <Parallel>());
            Expect(par._submachines.Count, Is.EqualTo(2));

            // Supply parallel statemachines as Array
            par = new Parallel("par", new[] {
                new StateMachine(),
                new StateMachine()
            });
            Expect(par.id, Is.EqualTo("par"));
            Expect(par, Is.InstanceOf <State>());
            Expect(par, Is.InstanceOf <Parallel>());
            Expect(par._submachines.Count, Is.EqualTo(2));

            // Start with an initially empty Parallel Statemachine
            par = new Parallel("par");
            par.AddStateMachine(new StateMachine()).AddStateMachine(new StateMachine());
            Expect(par.id, Is.EqualTo("par"));
            Expect(par, Is.InstanceOf <State>());
            Expect(par, Is.InstanceOf <Parallel>());
            Expect(par._submachines.Count, Is.EqualTo(2));
        }