Example #1
0
        public void ScoreCalculatorTest()                       //only here to test the ScoreCalculator class
        {
            List <List <int> > leest = new List <List <int> >() //need a "points" list of bowling points
            {
                new List <int>()
                {
                    10, 0
                },
                new List <int>()
                {
                    6, 0
                },
                new List <int>()
                {
                    5, 5
                },
                new List <int>()
                {
                    6, 3
                },
                new List <int>()
                {
                    7, 2
                },
                new List <int>()
                {
                    10, 0
                },
                new List <int>()
                {
                    10, 0
                },
                new List <int>()
                {
                    1, 3
                },
                new List <int>()
                {
                    1, 4
                },
                new List <int>()
                {
                    10, 1, 3
                }
            };
            BowlingPointsData bopoda = new BowlingPointsData(); //only used here to borrow its "WriteToConsole" method

            bopoda.points = leest;                              //so bopoda knows what to show.
            bopoda.WriteToConsole();                            //the call to show points to screeen.
            ScoreCalculator   sc  = new ScoreCalculator(leest); //now the scoreCalculator can work with the points.
            BowlingScoresData bsd = new BowlingScoresData();    //this is used to grab the scores, once they are calculated.

            //bsd.scores = sc.scores; //Here the scores get grapped.
            bsd.points = new List <int>();
            foreach (int i in sc.scores)
            {
                bsd.points.Add(i);
            }
            bsd.WriteToConsole(); //-and written to the console.
        }