Ejemplo n.º 1
0
        public void TestLoadBattingStatsFromFile()
        {
            int    expectedLines = 41;
            string path          = @"./Data/BaseballReference/Arizona Diamondbacks_(2001)/Arizona Diamondbacks_(2001) Batting.dat";

            Assert.IsTrue(File.Exists(path));
            try
            {
                BattingStats[] bStats = BattingStats.LoadBattingStats(path);
                Assert.IsTrue(bStats.Length == expectedLines);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Loads the batting stats.
 /// </summary>
 /// <param name="roster">Player[]</param>
 /// <param name="directory">string</param>
 private static void LoadBattingStats(ref Player [] roster, string directory)
 {
     BattingStats[] bStats = BattingStats.LoadBattingStats(TextUtilities.FormFilePathName(directory, "Batting", ".dat"));
     foreach (Player player in roster)
     {
         foreach (BattingStats bStat in bStats)
         {
             if (player.FullName.Equals(bStat.Name))
             {
                 player.BattingStats      = bStat;
                 player.BattingStatistics = new BattingStatisticsContainer(player);
                 player.SeasonStatistics  = new SeasonStatisticsContainer(player);
             }
         }
     }
 }