public void testAddPirzeLevel()
 {
     DivisionModel dm = new DivisionModel();
     for (int i = 0; i < testAmount; i++)
     {
         PrizeLevel pl = new PrizeLevel();
         pl.prizeValue = 100 + i;
         dm.addPrizeLevel(pl);
         Assert.IsTrue(dm.getPrizeLevel(i) != null, "PrizeLevel not added to Division.");
         Assert.IsTrue(dm.getPrizeLevel(i).prizeValue == 100 + i, "PrizeLevel not correct value.");
     }
 }
 public void testGetDivisionValue()
 {
     DivisionModel dm = new DivisionModel();
     double prizeLevel = 0.0f;
     for (int i = 0; i < testAmount; i++)
     {
         PrizeLevel pl = new PrizeLevel();
         pl.prizeValue = 100 + i;
         prizeLevel += pl.prizeValue;
         dm.addPrizeLevel(pl);
         Assert.IsTrue(dm.getPrizeLevel(i) != null, "PrizeLevel not added to Division.");
         Assert.IsTrue(dm.calculateDivisionValue() == prizeLevel, "PrizeLevel not correct value.");
     }
 }
        /// <summary>
        /// Validates each division
        ///     -Determines if the division is empty (has no selected prize levels)
        ///     -Validates a division's uniqueness from other divisions
        ///     -Validates whether a division's total collections is less than the total picks set
        ///     -Validates whether or not a division can have an instant win prize level
        /// </summary>
        public void validateDivision()
        {
            checkDivisionsPicks();

            for (int index = 0; index < divisionsHolderPanel.Children.Count; index++)
            {
                DivisionModel divToCompare = ((DivisionUC)divisionsHolderPanel.Children[index]).DivModel;
                bool          empty        = true;
                for (int i = 0; i < DivisionModel.MAX_PRIZE_BOXES && empty; i++)
                {
                    if (divToCompare.levelBoxes[i].IsSelected)
                    {
                        empty = false;
                    }
                }

                if (!empty)
                {
                    ErrorService.Instance.resolveWarning("005", new List <string> {
                        divToCompare.DivisionNumber.ToString()
                    }, divToCompare.errorID);
                    bool valid = true;
                    for (int i = 0; i < divisionsHolderPanel.Children.Count && valid; i++)
                    {
                        DivisionModel currentDiv = ((DivisionUC)divisionsHolderPanel.Children[i]).DivModel;
                        if (divToCompare.DivisionNumber != currentDiv.DivisionNumber)
                        {
                            bool isUnique = false;
                            for (int prizeIndex = 0; prizeIndex < prizes.getNumPrizeLevels() && !isUnique; prizeIndex++)
                            {
                                if (divToCompare.levelBoxes[prizeIndex].IsSelected != currentDiv.levelBoxes[prizeIndex].IsSelected)
                                {
                                    isUnique = true;
                                }
                            }

                            if (!isUnique)
                            {
                                divToCompare.errorID = ErrorService.Instance.reportError("009", new List <string> {
                                    divToCompare.DivisionNumber.ToString()
                                }, divToCompare.errorID);

                                valid = false;
                            }
                        }
                    }

                    if (valid)
                    {
                        ErrorService.Instance.resolveError("009", null, divToCompare.errorID);
                    }
                }
                else
                {
                    ErrorService.Instance.resolveError("009", null, divToCompare.errorID);
                    divToCompare.errorID = ErrorService.Instance.reportWarning("005", new List <string> {
                        divToCompare.DivisionNumber.ToString()
                    }, divToCompare.errorID);
                }

                int maxCollections = 0;
                for (int i = 0; i < divToCompare.getPrizeLevelsAtDivision().Count; i++)
                {
                    if (divToCompare.getPrizeLevel(i).isInstantWin)
                    {
                        maxCollections += 1;
                    }
                    else
                    {
                        maxCollections += divToCompare.getPrizeLevel(i).numCollections;
                    }
                }
                maxCollections -= GameSetupUC.pickCheck;
                for (int i = 0; i < prizes.getNumPrizeLevels(); i++)
                {
                    if (!divToCompare.getPrizeLevelsAtDivision().Contains(prizes.getPrizeLevel(i)))
                    {
                        maxCollections -= (prizes.getPrizeLevel(i).numCollections - 1);
                    }
                }


                if (0 < maxCollections)
                {
                    divToCompare.errorID = ErrorService.Instance.reportError("011", new List <string> {
                        divToCompare.DivisionNumber.ToString()
                    }, divToCompare.errorID);
                }
                else
                {
                    ErrorService.Instance.resolveError("011", null, divToCompare.errorID);
                }

                //Check if a Division can have an Instant Win
                int minimumCollections = GameSetupUC.pickCheck;
                for (int i = 0; i < divToCompare.getPrizeLevelsAtDivision().Count; i++)
                {
                    if (divToCompare.getPrizeLevel(i).isInstantWin)
                    {
                        minimumCollections -= 1;
                    }
                    else
                    {
                        minimumCollections -= divToCompare.getPrizeLevel(i).numCollections;
                    }
                }
                for (int i = 0; i < prizes.getNumPrizeLevels(); i++)
                {
                    if (!divToCompare.getPrizeLevelsAtDivision().Contains(prizes.getPrizeLevel(i)))
                    {
                        minimumCollections -= prizes.getPrizeLevel(i).numCollections - 1;
                    }
                }
                if (minimumCollections > 0)
                {
                    divToCompare.errorID = ErrorService.Instance.reportWarning("007", new List <string> {
                        divToCompare.DivisionNumber.ToString()
                    }, divToCompare.errorID);
                }
                else
                {
                    ErrorService.Instance.resolveWarning("007", null, divToCompare.errorID);
                }
            }

            int allCollections = 0;

            for (int i = 0; i < prizes.getNumPrizeLevels(); i++)
            {
                allCollections += prizes.getPrizeLevel(i).numCollections - 1;
            }

            if (GameSetupUC.pickCheck > allCollections)
            {
                dpucID = ErrorService.Instance.reportError("012", new List <string> {
                }, dpucID);
            }
            else
            {
                ErrorService.Instance.resolveError("012", null, dpucID);
            }
        }