Ejemplo n.º 1
0
        public void Repeater_Succeeds_If_Dont_Have_Child(int repeatAmnt)
        {
            RepeaterDecorator repeater = new RepeaterDecorator(repeatAmnt);

            for (int i = 0; i < repeatAmnt; i++)
            {
                Assert.IsTrue(repeater.Update() == (i == repeatAmnt - 1 ? NodeState.Success : NodeState.Running));
            }
        }
Ejemplo n.º 2
0
        public void Repeater_Only_Completes_After_Repeating_All_Times(int repeatAmnt, NodeState expected)
        {
            BTNode mock = Substitute.For <BTNode>();

            mock.Update().Returns(expected);

            RepeaterDecorator repeater = new RepeaterDecorator(repeatAmnt, mock);

            for (int i = 0; i < repeatAmnt; i++)
            {
                Assert.IsTrue(repeater.Update() == (i == repeatAmnt - 1 ? expected : NodeState.Running));
            }
        }