示例#1
0
        public void ShouldSucceed_WhenStoppedExplicitlyButChildStillFinishesSuccessfully()
        {
            MockNode       succeedingChild = new MockNode(true);
            RandomSelector sut             = new RandomSelector(succeedingChild);
            TestRoot       behaviorTree    = CreateBehaviorTree(sut);

            behaviorTree.Start();

            Assert.AreEqual(Node.State.ACTIVE, sut.CurrentState);

            sut.Stop();

            Assert.AreEqual(Node.State.INACTIVE, sut.CurrentState);
            Assert.IsTrue(behaviorTree.DidFinish);
            Assert.True(behaviorTree.WasSuccess);
        }
示例#2
0
        public void ShouldFail_WhenStoppedExplicitly()
        {
            MockNode       failingChild = new MockNode(false);
            RandomSelector sut          = new RandomSelector(failingChild);
            TestRoot       behaviorTree = CreateBehaviorTree(sut);

            behaviorTree.Start();

            Assert.AreEqual(Node.State.ACTIVE, sut.CurrentState);

            sut.Stop();

            Assert.AreEqual(Node.State.INACTIVE, sut.CurrentState);
            Assert.IsTrue(behaviorTree.DidFinish);
            Assert.IsFalse(behaviorTree.WasSuccess);
        }