public void test_SP_Straight_Calculation()
        {
            Dictionary <Team, List <Player> > pitcherDataByTeam = new Dictionary <Team, List <Player> >();

            setupTestTeams(pitcherDataByTeam);

            Dictionary <String, List <Player> > pitcherDataByBalance = SOMTeamReportFile.organizePitcherByBalance(pitcherDataByTeam);
            SOMTeamReportFile teamReportFile = new SOMTeamReportFile(pitcherDataByBalance, pitcherDataByTeam);

            IUsageCalculator calculator           = CalculatorFactory.getCalculator(CalculatorFactory.CalculatorType.SP_BASIC, teamReportFile, buildTeam("TEST1", IN_DIVISION));
            List <Dictionary <int, int> > results = calculator.calculate();

            verifyBasicLineupStructure(results);

            // Test L-1R
            runLineupTest(results, createTestTeamLineup("L", "1R", "1R"), 11);

            // Test L 9L->9R
            runLineupTest(results, createTestTeamLineup("L", "9L", "9R"), 152);

            // Test R 9R->9R
            runLineupTest(results, createTestTeamLineup("R", "9L", "9R"), 473);

            // Test R E
            runLineupTest(results, createTestTeamLineup("R", "E", "E"), 61);

            // Test R 6R-9R
            runLineupTest(results, createTestTeamLineup("R", "6R", "9R"), 24);

            // Test L 6R-8R
            runLineupTest(results, createTestTeamLineup("L", "6R", "8R"), 0);
        }
        public void test_Balance_Calculation_Multiple_Divisions()
        {
            Dictionary <Team, List <Player> > pitcherDataByTeam = new Dictionary <Team, List <Player> >();

            setupTestTeams(pitcherDataByTeam);

            Dictionary <String, List <Player> > pitcherDataByBalance = SOMTeamReportFile.organizePitcherByBalance(pitcherDataByTeam);
            SOMTeamReportFile teamReportFile = new SOMTeamReportFile(pitcherDataByBalance, pitcherDataByTeam);

            IUsageCalculator calculator = CalculatorFactory.getCalculator(CalculatorFactory.CalculatorType.SP_SCHEDULE, teamReportFile, buildTeam("TEST1", IN_DIVISION));

            calculator.setOptions(CalculatorOptions.OPTION_IN_DIVISION_GAMES, 26);
            calculator.setOptions(CalculatorOptions.OPTION_OUT_DIVISION_GAMES, 14);

            List <Dictionary <int, int> > results = calculator.calculate();

            verifyBasicLineupStructure(results);

            // Test L-1R
            runLineupTest(results, createTestTeamLineup("L", "1R", "1R"), 11);

            // Test L 9L->9R
            runLineupTest(results, createTestTeamLineup("L", "9L", "9R"), 158);

            // Test R 9R->9R
            runLineupTest(results, createTestTeamLineup("R", "9L", "9R"), 483);

            // Test R E
            runLineupTest(results, createTestTeamLineup("R", "E", "E"), 62);

            // Test R 6R-9R
            runLineupTest(results, createTestTeamLineup("R", "6R", "9R"), 25);
        }
        public void test_Balance_Calculation_Multiple_Divisions_On_Original_Spreadsheet()
        {
            Dictionary <Team, List <Player> > pitcherDataByTeam = new Dictionary <Team, List <Player> >();

            setupTestTeams(pitcherDataByTeam);

            Dictionary <String, List <Player> > pitcherDataByBalance = SOMTeamReportFile.organizePitcherByBalance(pitcherDataByTeam);
            SOMTeamReportFile teamReportFile = new SOMTeamReportFile(pitcherDataByBalance, pitcherDataByTeam);

            IUsageCalculator calculator = CalculatorFactory.getCalculator(CalculatorFactory.CalculatorType.SP_SCHEDULE, teamReportFile, buildTeam("TEST1", IN_DIVISION));

            calculator.setOptions(CalculatorOptions.OPTION_IN_DIVISION_GAMES, 26);
            calculator.setOptions(CalculatorOptions.OPTION_OUT_DIVISION_GAMES, 14);

            List <Dictionary <int, int> > results = calculator.calculate();

            verifyBasicLineupStructure(results);

            int idx = 0;

            for (int i = 8; i >= 0; i--)
            {
                int[] expectedLLeft  = { 0, 0, 0, 0, 0, 0, 20, 11, 34 };
                int[] expectedLRight = { 8, 0, 14, 0, 11, 0, 8, 96, 94 };

                // Test L-1R
                runLineupTest(results, createTestTeamLineup("L", (i + 1) + "L", (i + 1) + "L"), expectedLLeft[idx]);
                runLineupTest(results, createTestTeamLineup("R", (i + 1) + "L", (i + 1) + "L"), expectedLRight[idx]);
                idx++;
            }

            int expectedELeft  = 17;
            int expectedERight = 62;

            runLineupTest(results, createTestTeamLineup("L", "E", "E"), expectedELeft);
            runLineupTest(results, createTestTeamLineup("R", "E", "E"), expectedERight);

            for (int i = 0; i <= 8; i++)
            {
                int[] expectedRLeft  = { 11, 25, 12, 0, 0, 0, 0, 0, 28 };
                int[] expectedRRight = { 29, 57, 34, 45, 0, 19, 0, 6, 0 };

                // Test L-1R
                runLineupTest(results, createTestTeamLineup("L", (i + 1) + "R", (i + 1) + "R"), expectedRLeft[i]);
                runLineupTest(results, createTestTeamLineup("R", (i + 1) + "R", (i + 1) + "R"), expectedRRight[i]);
            }
        }
        public void test_SP_Straight_Based_On_Original_Spreadsheet()
        {
            Dictionary <Team, List <Player> > pitcherDataByTeam = new Dictionary <Team, List <Player> >();

            setupTestTeams(pitcherDataByTeam);

            Dictionary <String, List <Player> > pitcherDataByBalance = SOMTeamReportFile.organizePitcherByBalance(pitcherDataByTeam);
            SOMTeamReportFile teamReportFile = new SOMTeamReportFile(pitcherDataByBalance, pitcherDataByTeam);

            IUsageCalculator calculator           = CalculatorFactory.getCalculator(CalculatorFactory.CalculatorType.SP_BASIC, teamReportFile, buildTeam("TEST1", IN_DIVISION));
            List <Dictionary <int, int> > results = calculator.calculate();

            verifyBasicLineupStructure(results);

            int idx = 0;

            for (int i = 8; i >= 0; i--)
            {
                int[] expectedLLeft  = { 0, 0, 0, 0, 0, 0, 19, 10, 33 };
                int[] expectedLRight = { 7, 0, 13, 0, 10, 0, 7, 95, 94 };

                // Test L-1R
                runLineupTest(results, createTestTeamLineup("L", (i + 1) + "L", (i + 1) + "L"), expectedLLeft[idx]);
                runLineupTest(results, createTestTeamLineup("R", (i + 1) + "L", (i + 1) + "L"), expectedLRight[idx]);
                idx++;
            }

            int expectedELeft  = 16;
            int expectedERight = 61;

            runLineupTest(results, createTestTeamLineup("L", "E", "E"), expectedELeft);
            runLineupTest(results, createTestTeamLineup("R", "E", "E"), expectedERight);

            for (int i = 0; i <= 8; i++)
            {
                int[] expectedRLeft  = { 11, 25, 11, 0, 0, 0, 0, 0, 27 };
                int[] expectedRRight = { 29, 56, 34, 43, 0, 18, 0, 6, 0 };

                // Test L-1R
                runLineupTest(results, createTestTeamLineup("L", (i + 1) + "R", (i + 1) + "R"), expectedRLeft[i]);
                runLineupTest(results, createTestTeamLineup("R", (i + 1) + "R", (i + 1) + "R"), expectedRRight[i]);
            }
        }