public void GetSportTeamsTest() { //Arrange. TeamDto dummyTeam = new TeamDto() { name = "Dummy", photo = "Dummy", sportName = "Dummy" }; ICollection <TeamDto> cannedResponse = new List <TeamDto>() { dummyTeam, dummyTeam, dummyTeam }; sportsService.Setup(r => r.GetSport(It.IsAny <string>())).Returns(new SportDto() { name = "Dummy", isTwoTeams = true }); teamsRepo.Setup(r => r.GetSportTeams(It.IsAny <string>())).Returns(cannedResponse); //Act. IActionResult result = controllerToTest.GetTeams("Dummy"); OkObjectResult okResult = result as OkObjectResult; ICollection <TeamModelOut> teams = okResult.Value as ICollection <TeamModelOut>; //Assert. teamsRepo.Verify(r => r.GetSportTeams(It.IsAny <string>()), Times.Once); Assert.IsNotNull(result); Assert.IsNotNull(okResult); Assert.AreEqual(200, okResult.StatusCode); Assert.IsNotNull(teams); Assert.AreEqual(cannedResponse.Count, teams.Count); }