Пример #1
0
        public void IgnoreChildSuccess()
        {
            var repeater  = new RepeaterInfinite(true);
            var childNode = new AdjustableStateNode(NodeState.Inactive);

            repeater.Child = childNode;

            repeater.Start();
            repeater.Update();
            childNode.SetStatusOnNextUpdate(NodeState.Successful);
            repeater.Update();

            Assert.AreEqual(NodeState.Active, repeater.Status);
        }
Пример #2
0
        public void EndOnChildError()
        {
            var repeater  = new RepeaterInfinite();
            var childNode = new AdjustableStateNode(NodeState.Inactive);

            repeater.Child = childNode;

            repeater.Start();
            repeater.Update();
            childNode.SetStatusOnNextUpdate(NodeState.Error);
            repeater.Update();

            Assert.AreEqual(NodeState.Error, repeater.Status);
        }
Пример #3
0
        public void ChildEndsWhenRepeaterEnds()
        {
            var repeater  = new RepeaterInfinite(true);
            var childNode = new EventTrackingNode(NodeState.Successful);

            repeater.Child = childNode;

            repeater.Start();
            repeater.Update();
            repeater.Update();
            repeater.Update();
            repeater.End();

            Assert.IsTrue(childNode.HasEnded);
        }
Пример #4
0
        public void ChildSuccess()
        {
            var repeater  = new RepeaterInfinite();
            var childNode = new EventTrackingNode(NodeState.Inactive);

            repeater.Child = childNode;

            repeater.Start();
            repeater.Update();
            repeater.Update();
            childNode.SetStatusOnNextUpdate(NodeState.Successful);
            repeater.Update();

            Assert.AreEqual(NodeState.Successful, repeater.Status);
            Assert.AreEqual(3, childNode.UpdatesTotal);
            Assert.AreEqual(true, childNode.HasEnded);
        }
Пример #5
0
        public void StartChild()
        {
            var repeater  = new RepeaterInfinite();
            var childNode = new EventTrackingNode(NodeState.Inactive);

            repeater.Child = childNode;

            repeater.Start();
            repeater.Update();

            Assert.AreEqual(true, childNode.HasStarted);
        }
Пример #6
0
        public void ChildStartsWhenRepeaterUpdatesFirstTime()
        {
            var repeater  = new RepeaterInfinite();
            var childNode = new EventTrackingNode(NodeState.Error);

            repeater.Child = childNode;

            repeater.Start();
            repeater.Update();

            Assert.IsTrue(childNode.HasStarted);
            Assert.AreEqual(1, childNode.StartsTotal);
        }
Пример #7
0
        public void ChildMissing()
        {
            //arrange
            var repeater   = new RepeaterInfinite();
            var nodeStatus = NodeState.Inactive;

            //act
            repeater.Start();
            repeater.Update();
            nodeStatus = repeater.Status;

            //assert
            Assert.AreEqual(NodeState.Error, nodeStatus);
        }
Пример #8
0
        public void ChildActive()
        {
            var repeater  = new RepeaterInfinite();
            var childNode = new AdjustableStateNode(NodeState.Inactive);

            repeater.Child = childNode;
            var status = NodeState.Error;
            var count  = 1;

            repeater.Start();
            childNode.SetStatusOnNextUpdate(NodeState.Active);

            for (; count < 1000; count++)
            {
                repeater.Update();
                status = repeater.Status;
                if (status != NodeState.Active)
                {
                    break;
                }
            }

            Assert.AreEqual(1000, count);
        }