예제 #1
0
        public void GetScoreAverageReturnsNonEmptyRecordsetTest()
        {
            // Arrange
            Guid         team1Id        = Guid.Parse("03556285-bdbb-4576-a06d-42f71f46ddc5");
            Guid         team2Id        = Guid.Parse("f246a5e5-afdb-479c-9aaa-c68beeda7af6");
            Guid         team2PitcherId = Guid.Parse("03fda22a-f8a3-45e8-80dc-bf8190a22020");
            const string side           = "H";

            // Act
            Dictionary <string, double> scoreAverageDictionary = _dataAccessMlb.GetScoreAverage(team1Id, team2Id, team2PitcherId, side);

            // Assert
            Utils.PrintDictionary(scoreAverageDictionary);
            Assert.IsTrue(scoreAverageDictionary.Count == 9);
        }
예제 #2
0
        private void LoadModelDataInTsf()
        {
            if (HomePitcher == null || AwayPitcher == null)
            {
                Logger.Error("LoadModelDataInTsf(): HomePitcher or AwayPitcher is null");
                return;
            }

            Guid homeTeamId    = HomeTeam.TeamId;
            Guid awayTeamId    = AwayTeam.TeamId;
            Guid homePitcherId = HomePitcher.PlayerId;
            Guid awayPitcherId = AwayPitcher.PlayerId;

            string homeOrVistor = "H";
            Dictionary <string, double> homePlayerVersusTeam   = _dataAccessMlb.GetScoreAverage(homeTeamId, awayTeamId, awayPitcherId, homeOrVistor);
            Dictionary <string, double> homePlayerVersusLeague = _dataAccessMlb.GetScoreAveragePvL(homeTeamId, awayTeamId, awayPitcherId, homeOrVistor);
            Dictionary <string, double> homeTeamVersusTeam     = _dataAccessMlb.GetScoreAverageTvT(homeTeamId, awayTeamId, awayPitcherId, homeOrVistor);
            Dictionary <string, double> homeTeamVersusLeague   = _dataAccessMlb.GetScoreAverageTvL(homeTeamId, awayTeamId, awayPitcherId, homeOrVistor);

            //todo add default league stats

            Dictionary <string, double> homeDictionary;

            if (homePlayerVersusTeam.Count != 0 && homePlayerVersusLeague.Count != 0)
            {
                homeDictionary = Utils.MixDictionaries(homePlayerVersusTeam, homePlayerVersusLeague);
            }
            else if (homePlayerVersusLeague.Count != 0 && homeTeamVersusTeam.Count != 0)
            {
                homeDictionary = Utils.MixDictionaries(homePlayerVersusLeague, homeTeamVersusTeam);
            }
            else if (homeTeamVersusTeam.Count != 0 && homeTeamVersusLeague.Count != 0)
            {
                homeDictionary = Utils.MixDictionaries(homeTeamVersusTeam, homeTeamVersusLeague);
            }
            else if (homeTeamVersusLeague.Count != 0)
            {
                homeDictionary = homeTeamVersusLeague;
            }
            //else
            //{
            //    //??
            //}

            homeDictionary = homeTeamVersusLeague;
            homeOrVistor   = "V";
            //Dictionary<string, double> awayDictionary = _dataAccessMlb.GetScoreAverage(awayTeamId, homeTeamId, homePitcherId, homeOrVistor);
            Dictionary <string, double> awayPlayerVersusTeam   = _dataAccessMlb.GetScoreAverage(awayTeamId, homeTeamId, homePitcherId, homeOrVistor);
            Dictionary <string, double> awayPlayerVersusLeague = _dataAccessMlb.GetScoreAveragePvL(awayTeamId, homeTeamId, homePitcherId, homeOrVistor);
            Dictionary <string, double> awayTeamVersusTeam     = _dataAccessMlb.GetScoreAverageTvT(awayTeamId, homeTeamId, homePitcherId, homeOrVistor);
            Dictionary <string, double> awayTeamVersusLeague   = _dataAccessMlb.GetScoreAverageTvL(awayTeamId, homeTeamId, homePitcherId, homeOrVistor);

            //todo add default league stats

            Dictionary <string, double> awayDictionary;


            if (awayPlayerVersusTeam.Count != 0 && awayPlayerVersusLeague.Count != 0)
            {
                awayDictionary = Utils.MixDictionaries(awayPlayerVersusTeam, awayPlayerVersusLeague);
            }
            else if (awayPlayerVersusLeague.Count != 0 && awayTeamVersusTeam.Count != 0)
            {
                awayDictionary = Utils.MixDictionaries(awayPlayerVersusLeague, awayTeamVersusTeam);
            }
            else if (awayTeamVersusTeam.Count != 0 && awayTeamVersusLeague.Count != 0)
            {
                awayDictionary = Utils.MixDictionaries(awayTeamVersusTeam, awayTeamVersusLeague);
            }
            else if (awayTeamVersusLeague.Count != 0)
            {
                awayDictionary = awayTeamVersusLeague;
            }
            //else
            //{
            //    //??
            //}

            awayDictionary = awayTeamVersusLeague;

            Dictionary <string, double> mergedDictionary = Utils.MergeDictionaries(homeDictionary, awayDictionary);

            ModelData[MlbModelDataKeys.InTsf] = mergedDictionary;
        }