Exemplo n.º 1
0
            public RegularInstanceTest()
            {
                calledFlag = false;

                setting_NextState = new NormalState(new Trigger[1] {
                    new Trigger()
                });
                setting_TransitionMethod = () => {
                    calledFlag = true;
                    return;
                };

                transition = new Transition(setting_NextState, setting_TransitionMethod);
            }
Exemplo n.º 2
0
            public void TestConstructor(State setting_NextState, State expected_NextState,
                                        Transition.TransitionMethodDelegate setting_TransitionMethod,
                                        Transition.TransitionMethodDelegate expected_TransitionMethod)
            {
                // Execute
                Transition transition = new Transition(setting_NextState, setting_TransitionMethod);

                // Get result
                Type      type       = typeof(Transition);
                FieldInfo field_info = type.GetField("NextState",
                                                     BindingFlags.GetField | BindingFlags.NonPublic | BindingFlags.Instance);
                State actual_NextState = (State)field_info.GetValue(transition);

                field_info = type.GetField("TransitionMethod",
                                           BindingFlags.SetField | BindingFlags.NonPublic | BindingFlags.Instance);
                var actual_TransitionMethod = (Transition.TransitionMethodDelegate)field_info.GetValue(transition);

                // Validate
                Assert.Equal(expected_NextState, actual_NextState);
                Assert.Equal(expected_TransitionMethod, actual_TransitionMethod);
            }
Exemplo n.º 3
0
 public void TestNullParameter(State setting_NextState, Transition.TransitionMethodDelegate setting_TransitionMethod)
 {
     // Execute, Validate
     Assert.Throws <NotImplementedException>(() => new Transition(setting_NextState, setting_TransitionMethod));
 }
Exemplo n.º 4
0
            public RegularInstanceTest()
            {
                calledFlag = false;

                setting_NextState = new NormalState(new Trigger[1] { new Trigger() });
                setting_TransitionMethod = () => {
                    calledFlag = true;
                    return;
                };

                transition = new Transition(setting_NextState, setting_TransitionMethod);
            }