public async Task GetTeamsTest() { var movies = new List <Team> { new Team() { TeamName = "test messi1" }, new Team() { TeamName = "test messi2" } }; var fakeRepositoryMock = new Mock <IteamRepository>(); fakeRepositoryMock.Setup(x => x.GetAll()).ReturnsAsync(movies); var playerService = new TeamServices(fakeRepositoryMock.Object); var resultTeams = await playerService.GetPlayers(); Assert.Collection(resultTeams, player => { Assert.Equal("test messi1", player.TeamName); }, player => { Assert.Equal("test messi2", player.TeamName); }); }