public void PlayerCountTest() { Mock <IRepository <Player> > mockedRepo = new Mock <IRepository <Player> >(MockBehavior.Loose); List <Player> playerlist = new List <Player>() { new Player() { IgazolasSzama = Guid.NewGuid().ToString(), PlayerName = "Van Dijk", Nationality = "Netherland", Rating = 90, WeakFoot = 2 /*,Csapat = teamlist[0]*/ }, new Player() { IgazolasSzama = Guid.NewGuid().ToString(), PlayerName = "Ács Péter", Nationality = "Hungary", Rating = 76, WeakFoot = 5, /*Csapat =teamlist[1]*/ }, new Player() { IgazolasSzama = Guid.NewGuid().ToString(), PlayerName = "Cristano Ronaldo", Nationality = "Portugal", Rating = 94, WeakFoot = 5, /*Csapat =teamlist[2]*/ } }; mockedRepo.Setup(repo => repo.Read()); var expected = playerlist.Count; StatLogic stl = new StatLogic(mockedRepo.Object); var result = stl.PlayerCount(playerlist); Assert.That(result, Is.EqualTo(expected)); }
//---------------------------------------------------------------------------------------------------------------------------- //NON CRUD public IActionResult Stat() { Stat s = new Stat(); s.LegnagyobbLiga = statLogic.LegNagyobbLiga(); s.MaxRatingJatekos = statLogic.MaxRatedPlayer(); s.JatekosokSzama = statLogic.PlayerCount(playerlogic.GetAllPlayers().ToList()); s.LeagueCount = statLogic.LeagueCount(); s.AvgRatingLeaguename = statLogic.TeamAVGPlayer(/*playerlogic.GetAllPlayers().ToList(),teamlogic.GetAllTeam().ToList()*/); s.FilteredPlayers = statLogic.FilterPlayers("Juventus"); s.WeakFootTeam = statLogic.BESTWEAKFOOTSUMBYTEAM(); return(View(s)); }