public void GetSquadReturnPlayersToChosenTeamAndSetPropertiesCorectly() { var playersList = new List <Player>() { new Player { ShortName = "L.Messi", ScoredGoals = 10, MatchesPlayed = 1, Age = 33, DateOfBirth = DateTime.Parse("12/12/1986"), HeightCm = 166, WeightKg = 70, Nationality = "Argentina", TeamNumber = 10, TeamId = 1, }, new Player { ShortName = "C.Ronaldo", ScoredGoals = 11, MatchesPlayed = 2, Age = 35, DateOfBirth = DateTime.Parse("12/12/1984"), HeightCm = 186, WeightKg = 80, Nationality = "Portugal", TeamNumber = 7, TeamId = 1, }, }; var teamsList = new List <Team>() { new Team { Id = 1, Name = "Real Madrid", Players = playersList, }, new Team { Id = 2, Name = "Barcelona", }, }; var teamRepo = new Mock <IDeletableEntityRepository <Team> >(); teamRepo.Setup(x => x.All()).Returns(teamsList.AsQueryable()); var matchRepo = new Mock <IDeletableEntityRepository <Match> >(); var service = new TeamsService(teamRepo.Object, matchRepo.Object); var team = service.GetSquad(1); var playerFirstName = team.Players.Select(x => x.ShortName).FirstOrDefault(); var playerSquadNumber = team.Players.Select(x => x.SquadNumber).FirstOrDefault(); var scoredGoals = team.Players.Select(x => x.ScoredGoals).FirstOrDefault(); var age = team.Players.Select(x => x.Age).FirstOrDefault(); var matchesPlayed = team.Players.Select(x => x.MatchesPlayed).FirstOrDefault(); var weight = team.Players.Select(x => x.WeightKg).FirstOrDefault(); var height = team.Players.Select(x => x.HeightCm).FirstOrDefault(); var dateOfBirth = team.Players.Select(x => x.DateOfBirth).FirstOrDefault(); var nationality = team.Players.Select(x => x.Nationality).FirstOrDefault(); Assert.Equal("Real Madrid", team.TeamName); Assert.Equal(2, team.Players.Count()); Assert.Equal(7, playerSquadNumber); Assert.Equal("C.Ronaldo", playerFirstName); Assert.Equal(11, scoredGoals); Assert.Equal(35, age); Assert.Equal(2, matchesPlayed); Assert.Equal(80, weight); Assert.Equal(186, height); Assert.Equal(DateTime.Parse("12/12/1984"), dateOfBirth); Assert.Equal("Portugal", nationality); }