public void AllPromotions_ContainsAllChosenAndAppendedPromotions()
        {
            var promotionOne = BuildPromotion("Promotion One");
            var promotionTwo = BuildPromotion("Promotion Two");

            var promotionThree = BuildPromotion("Promotion Three");

            BuildPromotion("Promotion Three");

            var treeData = BuildPromotionTreeData(new List <IPromotionPrerequisiteData>()
            {
                BuildPrereqData(promotionOne, new List <IPromotion>()),
                BuildPrereqData(promotionTwo, new List <IPromotion>()),
            });

            var promotionTree = new PromotionTree(treeData);

            promotionTree.ChoosePromotion(promotionOne);
            promotionTree.ChoosePromotion(promotionTwo);

            promotionTree.AppendPromotion(promotionThree);

            CollectionAssert.AreEquivalent(
                new List <IPromotion>()
            {
                promotionOne, promotionTwo, promotionThree
            },
                promotionTree.GetAllPromotions()
                );
        }
        public void GetAvailablePromotions_ExcludesChosenPromotions()
        {
            var promotionOne   = BuildPromotion("Promotion One");
            var promotionTwo   = BuildPromotion("Promotion Two");
            var promotionThree = BuildPromotion("Promotion Three");

            var treeData = BuildPromotionTreeData(new List <IPromotionPrerequisiteData>()
            {
                BuildPrereqData(promotionOne, new List <IPromotion>()),
                BuildPrereqData(promotionTwo, new List <IPromotion>()),
                BuildPrereqData(promotionThree, new List <IPromotion>()),
            });

            var promotionTree = new PromotionTree(treeData);

            promotionTree.ChoosePromotion(promotionOne);
            promotionTree.ChoosePromotion(promotionTwo);

            CollectionAssert.AreEquivalent(
                new List <IPromotion>()
            {
                promotionThree
            },
                promotionTree.GetAvailablePromotions()
                );
        }
        public void GetAvailablePromotions_GetsPromotionsWithSomeChosenPrerequisite()
        {
            var promotionOne   = BuildPromotion("Promotion One");
            var promotionTwo   = BuildPromotion("Promotion Two");
            var promotionThree = BuildPromotion("Promotion Three");
            var promotionFour  = BuildPromotion("Promotion Four");

            var treeData = BuildPromotionTreeData(new List <IPromotionPrerequisiteData>()
            {
                BuildPrereqData(promotionOne, new List <IPromotion>()),
                BuildPrereqData(promotionTwo, new List <IPromotion>()),
                BuildPrereqData(promotionThree, new List <IPromotion>()
                {
                    promotionOne
                }),
                BuildPrereqData(promotionFour, new List <IPromotion>()
                {
                    promotionOne, promotionTwo
                }),
            });

            var promotionTree = new PromotionTree(treeData);

            promotionTree.ChoosePromotion(promotionOne);

            CollectionAssert.AreEquivalent(
                new List <IPromotion>()
            {
                promotionTwo, promotionThree, promotionFour
            },
                promotionTree.GetAvailablePromotions()
                );
        }
        public void ChoosePromotion_PromotionsChangedEventFired()
        {
            var promotionOne = BuildPromotion("Promotion One");
            var promotionTwo = BuildPromotion("Promotion Two");

            var treeData = BuildPromotionTreeData(new List <IPromotionPrerequisiteData>()
            {
                BuildPrereqData(promotionOne, new List <IPromotion>()),
                BuildPrereqData(promotionTwo, new List <IPromotion>())
            });

            var promotionTree = new PromotionTree(treeData);

            promotionTree.PromotionsChanged += delegate(object sender, EventArgs e) {
                Assert.Pass();
            };

            promotionTree.ChoosePromotion(promotionOne);

            Assert.Fail("NewPromotionChosen was never fired");
        }
        public void ChoosePromotion_ReflectedInGetChosenPromotions()
        {
            var promotionOne = BuildPromotion("Promotion One");
            var promotionTwo = BuildPromotion("Promotion Two");

            var treeData = BuildPromotionTreeData(new List <IPromotionPrerequisiteData>()
            {
                BuildPrereqData(promotionOne, new List <IPromotion>()),
                BuildPrereqData(promotionTwo, new List <IPromotion>())
            });

            var promotionTree = new PromotionTree(treeData);

            promotionTree.ChoosePromotion(promotionOne);

            CollectionAssert.AreEquivalent(
                new List <IPromotion>()
            {
                promotionOne
            },
                promotionTree.GetChosenPromotions()
                );
        }