public void ItGetsTheTotalPoints()
{
using (IDataContext dataContext = new NemeStatsDataContext())
{
IPlayerRepository playerRepository = new EntityFrameworkPlayerRepository(dataContext);
IPlayedGameRetriever playedGameRetriever = new PlayedGameRetriever(dataContext);
IPlayerRetriever playerRetriever = new PlayerRetriever(dataContext, playerRepository, playedGameRetriever);
PlayerStatistics playerStatistics = playerRetriever.GetPlayerStatistics(testPlayer1.Id);
int totalBasePoints = 0;
int totalGameDurationPoints = 0;
int totalWeightBonusPoints = 0;
foreach(PlayedGame playedGame in testPlayedGames)
{
if(playedGame.PlayerGameResults.Any(result => result.PlayerId == testPlayer1.Id))
{
var playerGameResult = playedGame.PlayerGameResults.First(result => result.PlayerId == testPlayer1.Id);
totalBasePoints += playerGameResult.NemeStatsPointsAwarded;
totalGameDurationPoints += playerGameResult.GameDurationBonusPoints;
totalWeightBonusPoints += playerGameResult.GameWeightBonusPoints;
}
}
Assert.AreEqual(totalBasePoints, playerStatistics.NemePointsSummary.BaseNemePoints);
Assert.AreEqual(totalGameDurationPoints, playerStatistics.NemePointsSummary.GameDurationBonusNemePoints);
Assert.AreEqual(totalWeightBonusPoints, playerStatistics.NemePointsSummary.WeightBonusNemePoints);
}
}