Esempio n. 1
0
        public void AddGetScoreTest()
        {
            PlayersRepository playersRepository = new PlayersRepository(ConnectionString);
            GamesRepository   gamesRepository   = new GamesRepository(ConnectionString);
            ScoresRepository  scoresRepository  = new ScoresRepository(ConnectionString);

            string playerName = GetRandomName(10);
            string gameName   = GetRandomName(10);

            playersRepository.AddPlayer(new Player(playerName));
            _playersList.Add(playerName);

            gamesRepository.AddGame(new Game(gameName));
            _gamesList.Add(gameName);

            Guid scoreId = Guid.NewGuid();

            _scoresList.Add(scoreId);
            Score score = new Score(scoreId, playerName, gameName, scores: 5);

            scoresRepository.AddScore(score);

            Assert.AreEqual(scoreId, scoresRepository.GetScore(scoreId).Id);
        }
 /// <summary>
 /// Get score by id
 /// </summary>
 /// <param name="id">score id</param>
 /// <returns>score model</returns>
 public virtual Score GetScore(Guid id)
 {
     Logger.Logger.Instance.Info($"Getting score by id: {id}.");
     return(_scoresRepository.GetScore(id));
 }