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 GetAvailablePromotions_GetsAllPromotionsWithNoPrerequisites()
        {
            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>()
                {
                    BuildPromotion("")
                }),
            });

            var promotionTree = new PromotionTree(treeData);

            CollectionAssert.AreEquivalent(
                new List <IPromotion>()
            {
                promotionOne, promotionTwo
            },
                promotionTree.GetAvailablePromotions()
                );
        }
        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_DrivenByPrerequisiteData()
        {
            var prerequisiteData = new List <IPromotionPrerequisiteData>()
            {
                BuildPrereqData(BuildPromotion("Promotion One"), new List <IPromotion>()),
                BuildPrereqData(BuildPromotion("Promotion Two"), new List <IPromotion>()),
                BuildPrereqData(BuildPromotion("Promotion Three"), new List <IPromotion>()),
                BuildPrereqData(BuildPromotion("Promotion Four"), new List <IPromotion>()),
            };

            var promotionTree = new PromotionTree(BuildPromotionTreeData(prerequisiteData));

            CollectionAssert.AreEquivalent(
                prerequisiteData.Select(data => data.Promotion),
                promotionTree.GetAvailablePromotions()
                );
        }
        public void GetAvailablePromotions_ExcludesPromotionsWithNoChosenPrerequisite()
        {
            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>()
                {
                    promotionOne
                }),
            });

            var promotionTree = new PromotionTree(treeData);

            CollectionAssert.DoesNotContain(promotionTree.GetAvailablePromotions(), promotionThree);
        }