public void TraverseToParentTest()
        {
            //Arrange
            int position = 0;

            List <Quest> children = new List <Quest>()
            {
                new FakeQuest(),
            };

            Quest parent = new FakeQuest {
                Children = children
            };


            Quest childToTraverse = children[position];

            childToTraverse.Parent = parent;


            IQuestTree tree = MockRepository.GenerateStrictMock <IQuestTree>();

            tree.Expect(tr => tr.IsInitialized()).
            Repeat.Once().
            Return(true);
            tree.Expect(tr => tr.Initialize()).
            Repeat.Never();
            tree.Expect(tr => tr.Root).
            Repeat.Times(4).
            Return(parent);
            tree.Expect(tr => tr.LoadChildren(Arg <Quest> .Is.Equal(childToTraverse))).
            Repeat.Once();
            tree.Expect(tr => tr.UnloadChildren(Arg <Quest> .Is.Equal(childToTraverse))).
            Repeat.Once();

            QuestListModelTopChildrenPredicate list = new QuestListModelTopChildrenPredicate(tree, q => true);

            //Act
            list.Initialize();
            bool traverseResult         = list.TraverseToLeaf(position);
            bool traverseToParentResult = list.TraverseToParent();

            Quest        listParent   = list.Parent;
            List <Quest> listChildren = list.Leaves;

            //Assert
            Assert.AreEqual(parent, listParent);
            Assert.AreEqual(children, listChildren);

            Assert.IsTrue(traverseResult);
            Assert.IsTrue(traverseToParentResult);

            tree.VerifyAllExpectations();
        }
        public void TraverseToParentInTopRootAlreadyTest()
        {
            //Arrange
            List <Quest> children = new List <Quest>()
            {
                new FakeQuest(),
                new FakeQuest(),
                new FakeQuest(),
                new FakeQuest()
            };

            Quest parent = new FakeQuest {
                Children = children
            };

            IQuestTree tree = MockRepository.GenerateStrictMock <IQuestTree>();

            tree.Expect(tr => tr.IsInitialized()).
            Repeat.Once().
            Return(true);
            tree.Expect(tr => tr.Initialize()).
            Repeat.Never();
            tree.Expect(tr => tr.Root).
            Repeat.Times(3).
            Return(parent);

            QuestListModelTopChildrenPredicate list = new QuestListModelTopChildrenPredicate(tree, q => true);

            //Act
            list.Initialize();
            bool traverseResult = list.TraverseToParent();

            //Assert

            Assert.IsFalse(traverseResult);
            tree.VerifyAllExpectations();
        }