Exemplo n.º 1
0
            private void OnPerform(object sender, object args)
            {
                var action = args as TestAction;
                var marks  = action.OrderOfPlay == RootActionOrder ? ActionMarks : reactionMarks;

                marks.Perform     = true;
                action.DidPerform = true;

                if (action.OrderOfPlay != RootActionOrder)
                {
                    Reactions.Add(action);
                }
                else
                {
                    AddReactions((IContainer)sender);
                }

                if (action.Priority == DepthCheckPriority)
                {
                    var reaction = new TestAction {
                        OrderOfPlay = DepthReactionOrder
                    };
                    ((IContainer)sender).GetAspect <ActionSystem>().AddReaction(reaction);
                }

                if (action.OrderOfPlay == DepthReactionOrder)
                {
                    DepthFirst = (Reactions.Count == 2);
                }
            }
        public void Setup()
        {
            action = new TestAction();
            context = TestHelper.RequestContext();
            locator = new FakeServiceLocator();
            locator.Add<IActionMethodSelector>(new DefaultActionMethodSelector());

            adaptor = new ControllerAdaptor(action, locator) { TempDataProvider = new NullTempDataProvider()};
        }
Exemplo n.º 3
0
        public void TestCase1()
        {
            TestAction action = new TestAction();
            _history.ExecuteAndRecord(action);

            Assert.IsTrue(_history.CanUndo);
            Assert.IsFalse(_history.CanRedo);
            Assert.AreEqual(action, _history.UndoAction);
            Assert.AreEqual(_history.UndoStackCount, 1);
        }
        public void Setup()
        {
            action  = new TestAction();
            context = TestHelper.RequestContext();
            locator = new FakeServiceLocator();
            locator.Add <IActionMethodSelector>(new DefaultActionMethodSelector());

            adaptor = new ControllerAdaptor(action, locator)
            {
                TempDataProvider = new NullTempDataProvider()
            };
        }
Exemplo n.º 5
0
        public void CancellingAction_ActionDoesNotFinish()
        {
            var action = new TestAction();

            action.Cancel();
            actionSystem.Perform(action);

            RunToCompletion();

            Assert.IsFalse(action.DidPrepare);
            Assert.IsFalse(action.DidPerform);
        }
        public void Setup()
        {
            filters = new FilterCollection();

            locator = new FakeServiceLocator();
            locator.Add(filters);
            locator.Add<IActionMethodSelector>(new DefaultActionMethodSelector());

            context = TestHelper.RequestContext();
            context.RouteData.Values.Add("action","test");

            action = new TestAction();
            adaptor = new ControllerAdaptor(action, locator) { TempDataProvider = new NullTempDataProvider() };
        }
Exemplo n.º 7
0
        public void RunningPhaseWithoutKeyframe_HandlerIsTriggered()
        {
            var action = new TestAction(10, -1);
            var phase  = new Phase(action, action.KeyFrameHandler)
            {
                Viewer = action.KeyframeViewer
            };

            var flow = phase.Flow(null);

            while (flow.MoveNext())
            {
            }

            Assert.IsTrue(action.IsComplete);
        }
Exemplo n.º 8
0
        public void RunningPhase_CompletesViewerFlow()
        {
            var action = new TestAction(10, 5);
            var phase  = new Phase(action, action.KeyFrameHandler)
            {
                Viewer = action.KeyframeViewer
            };

            var flow = phase.Flow(null);

            while (flow.MoveNext())
            {
            }

            Assert.AreEqual(action.Step, action.LoopCount);
        }
Exemplo n.º 9
0
            private void AddReactions(IContainer container)
            {
                for (int i = 0; i < 5; ++i)
                {
                    var reaction = new TestAction {
                        OrderOfPlay = Random.Range(1, 100)
                    };

                    if (i == 2)
                    {
                        reaction.Priority = DepthCheckPriority;
                    }

                    container.GetAspect <ActionSystem>().AddReaction(reaction);
                }
            }
Exemplo n.º 10
0
        public void Setup()
        {
            filters = new FilterCollection();

            locator = new FakeServiceLocator();
            locator.Add(filters);
            locator.Add <IActionMethodSelector>(new DefaultActionMethodSelector());

            context = TestHelper.RequestContext();
            context.RouteData.Values.Add("action", "test");

            action  = new TestAction();
            adaptor = new ControllerAdaptor(action, locator)
            {
                TempDataProvider = new NullTempDataProvider()
            };
        }
Exemplo n.º 11
0
            private void OnDeath(object sender, object args)
            {
                var action = args as TestAction;
                var marks  = action.OrderOfPlay == RootActionOrder ? ActionMarks : reactionMarks;

                if (!ActionMarks.DeathReaper)
                {
                    var reaction = new TestAction {
                        OrderOfPlay = int.MaxValue
                    };
                    ((ActionSystem)sender).AddReaction(reaction);
                }
                else
                {
                    LoopedDeath = true;
                }

                marks.DeathReaper = true;
            }
Exemplo n.º 12
0
        public void RunningPhaseWithKeyframe_HandlerIsTriggeredOnKeyframe()
        {
            var action = new TestAction(10, 5);
            var phase  = new Phase(action, action.KeyFrameHandler)
            {
                Viewer = action.KeyframeViewer
            };

            var flow = phase.Flow(null);

            while (flow.MoveNext())
            {
                if (action.Step < action.Keyframe)
                {
                    Assert.IsFalse(action.IsComplete);
                }
                else if (action.Step > action.Keyframe)
                {
                    Assert.IsTrue(action.IsComplete);
                }
            }
        }
Exemplo n.º 13
0
        public void TestCase5()
        {
            TestAction action = new TestAction();
            _history.RecordAction(new TestAction());
            _history.RecordAction(action);
            _history.ExecutedLastRecordedAction();

            Assert.IsTrue(_history.CanUndo);
            Assert.IsFalse(_history.CanRedo);
            Assert.AreEqual(_history.UndoStackCount, 2);
            Assert.AreEqual(action, _history.UndoAction);
        }