Exemple #1
0
 /// <summary>
 /// Loads the pitching stats.
 /// </summary>
 /// <param name="roster">Player[]</param>
 /// <param name="directory">string</param>
 private static void LoadPitchingStats(ref Player[] roster, string directory)
 {
     PitchingStats[] pStats = PitchingStats.LoadPitchingStats(TextUtilities.FormFilePathName(directory, "Pitching", ".dat"));
     foreach (Player player in roster)
     {
         foreach (PitchingStats pStat in pStats)
         {
             if (player.FullName.Equals(pStat.Name))
             {
                 player.PitchingStats      = pStat;
                 player.PitchingStatistics = new PitchingStatisticsContainer(player);
             }
         }
     }
 }
        public void TestLoadPitchingStatsFromFile()
        {
            string path = @"./Data/BaseballReference/Arizona Diamondbacks_(2001)/Arizona Diamondbacks_(2001) Pitching.dat";

            PitchingStats[] pstats = null;
            Assert.IsTrue(File.Exists(path));
            try
            {
                int EXPECTED_LENGTH = 21;
                pstats = PitchingStats.LoadPitchingStats(path);
                pstats.ToList().ForEach(Console.WriteLine);
                Assert.IsTrue(pstats.Length == EXPECTED_LENGTH);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }