public void WriteOnFailure_Green()
        {
            var root = new SequenceNode();
            var fail = new TaskFailureNode();

            fail.AppendDecorator(new SetValueOnFail("foo", () => 1));
            root.Append(fail);

            BT.BT bt = new BT.BT(root);
            bt.BlackBoard.SetValue("foo", 0);

            Assert.That(bt.BlackBoard.ReadValue <int>("foo"), Is.EqualTo(0));
            bt.Run();
            Assert.That(bt.BlackBoard.ReadValue <int>("foo"), Is.EqualTo(1));
        }
        public void ConditionSuccessSingle()
        {
            var root = new SequenceNode();
            var succ = new TaskSuccessNode();

            succ.AppendDecorator(new ConditionSuccess());
            root.Append(succ);

            var fail = new TaskFailureNode();

            fail.AppendDecorator(new ConditionFail());
            root.Append(fail);

            Assert.That(root.Run(null), Is.EqualTo(NodeState.Success));         //should skip the fail node
            Assert.That(succ.executed, Is.EqualTo(true));
            Assert.That(fail.executed, Is.EqualTo(false));
        }