Exemplo n.º 1
0
        public void Should_Sort_All_Players_By_Skill_When_Get_Top_Players()
        {
            SoccerTeamsManager.SoccerTeamsManager manager = new SoccerTeamsManager.SoccerTeamsManager();
            _mockTeam.ForEach(team => manager.AddTeam(team.Id, team.Name, team.Created, team.MainShirtColor, team.SecondaryShirtColor));
            //_mockPlayer.ForEach(player => manager.AddPlayer(player.Id, player.TeamId, player.Name, player.BirthDate, player.SkillLevel, player.Salary));

            var playersIds = new List <long>()
            {
                7, 33, 2, 70, 10, 240, 73, 1, 50, 17, 220, 14, 5
            };

            for (int i = 0; i < playersIds.Count(); i++)
            {
                manager.AddPlayer(playersIds[i], 1, $"Jogador {i}", DateTime.Today, (i + 1) + 10, 0);
            }

            Assert.Equal(playersIds.Take(10).Count(), manager.GetTopPlayers(10).Count());
        }
Exemplo n.º 2
0
        public void Top_Jogadores()
        {
            var manager = new SoccerTeamsManager.SoccerTeamsManager();

            manager.AddTeam(1, "Time 1", DateTime.Now, "cor 1", "cor 2");

            var playersIds = new List <long>()
            {
                15, 2, 33, 4, 13, 22, 23, 26, 70
            };

            for (int i = 0; i < playersIds.Count(); i++)
            {
                manager.AddPlayer(playersIds[i], 1, $"Jogador {i}", DateTime.Today, i + 10, 0);
            }

            Assert.Equal(playersIds.Take(3).Count(), manager.GetTopPlayers(3).Count());
        }