public List <UserTopDTO> GetRelativeRanking(int atNumber, int quantity) { Logger.Trace("GameBusiness", "GetRelativeRanking", "Starting the method"); List <UserTopDTO> result = null; try { var unitOfWork = Database.Context.Instance; var userGameRepository = new UserGameRepository(unitOfWork); var userGames = userGameRepository.GetRelativeRanking(atNumber, quantity); result = ListUserGaMeToListUserTopDTO(userGames, atNumber - quantity); } catch (Exception e) { Logger.Error("GameBusiness", "GetRelativeRanking", e.Message); throw e; } finally { Logger.Trace("GameBusiness", "GetRelativeRanking", "Finishing method"); } return(result); }
public void GetRelativeRanking() { var userGameRepository = new UserGameRepository(Database.Context.Instance); var result = userGameRepository.GetRelativeRanking(10, 2); Assert.IsNotNull(result); Assert.IsNotNull(result.Count == 5); Assert.IsNotNull(result.First().Score >= result.Last().Score); result = userGameRepository.GetRelativeRanking(100, 10); Assert.IsNotNull(result.Count == 21); Assert.IsNotNull(result.First().Score >= result.Last().Score); }