public static List <Player> GetTop(string type, int number, IPlayersData data) { List <Player> top; if (data.GetAllPlayers().Count <= number) { top = data.GetAllPlayers(); } else { top = new List <Player>(); switch (type) { case "Gross profit": top = data.GetAllPlayers().OrderByDescending(o => o.Total_gross_profit).Take(number).ToList(); break; case "Highest gain": top = data.GetAllPlayers().OrderByDescending(o => o.Best_win).Take(number).ToList(); break; case "Number of games": top = data.GetAllPlayers().OrderByDescending(o => o.Num_of_games).Take(number).ToList(); break; } } return(top); }
public void RegisterGoodTest() { Player player = new Player(10, "ronen", "1234", "*****@*****.**", leaguesData.GetDefalutLeague().Id); int users = playersData.GetAllPlayers().Count; string ans = PlayerAction.Register(player, playersData); Assert.IsTrue(ans.Equals("ok")); Assert.IsTrue(users == playersData.GetAllPlayers().Count - 1); }