コード例 #1
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);
        }
コード例 #2
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);
        }
コード例 #3
0
        public void EndBeforeUpdate()
        {
            var repeater  = new RepeaterInfinite();
            var childNode = new EventTrackingNode(NodeState.Inactive);

            repeater.Child = childNode;

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

            Assert.AreEqual(false, childNode.HasStarted);
            Assert.AreEqual(false, childNode.HasEnded);
            Assert.AreEqual(0, childNode.UpdatesTotal);
        }
コード例 #4
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);
        }
コード例 #5
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);
        }
コード例 #6
0
        public void ChildError()
        {
            var repeater  = new RepeaterInfinite();
            var childNode = new EventTrackingNode(NodeState.Inactive);

            repeater.Child = childNode;

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

            Assert.AreEqual(NodeState.Error, repeater.Status);
            Assert.AreEqual(true, childNode.HasEnded);
        }
コード例 #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 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);
        }
コード例 #9
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);
        }