public static ChampionshipStatistic GetChampionships(Result[,] results, PointScoringSystem pointSystem, bool doublePoints) { ChampionshipStatistic statistic = new ChampionshipStatistic(); statistic.PointSystem = pointSystem; statistic.DoublePoints = doublePoints; statistic.SetResults(results); statistic.CalculateStatistics(); statistic.Sort(OrderType.Descending, SortType.Value); return statistic; }
public void TestPopulateChampionshipResults() { var Data = new Data(); ChampionshipStatistic statistic = new ChampionshipStatistic(); Result[,] results = new Result[Data.NumberOfDrivers, Data.NumberOfTracks]; for (int i = 0; i < Data.NumberOfDrivers; i++) { //First round results: results[i, 0].position = (i + 1); } statistic.SetResults(results); statistic.CalculateStatistics(); statistic.Sort(OrderType.Descending, SortType.Value); Assert.AreEqual(0, statistic.DriverStats[0].CompetitorIndex); Assert.AreEqual(25, ((ChampionshipDataElement)statistic.DriverStats[0]).Points); Assert.AreEqual(43, ((ChampionshipDataElement)statistic.TeamStats[0]).Points); Assert.AreEqual(1, ((ChampionshipDataElement)statistic.TeamStats[0]).NumberOfResults[0]); }