public void ShouldSearchForPetsByOwner() { //AAA //1. Arrange mockPetRepo = new Mock <IPetRepo>(); List <Pet> mockPets = CreateMockPetData(); mockPetRepo.Setup(m => m.ListAllPets()).Returns(mockPets); //Logic will be in the controller method mockPetRepo.Setup(m => m.ListAllClients()).Returns(new List <Client>()); int expectedNumberOfPetsInList = 2; PetController petController = new PetController(mockPetRepo.Object); //DropDownList for owners [Text = Full name of the owner ? Value = Id] string clientID = "001"; string petType = null; DateTime?startDate = null; DateTime?endDate = null; SearchForPetsViewModel viewModel = new SearchForPetsViewModel(); viewModel.ClientID = clientID; viewModel.PetType = petType; viewModel.StartDate = startDate; viewModel.EndDate = endDate; viewModel.UserFirstVisit = "No"; //2. Act ViewResult result = petController.SearchForPets(viewModel) as ViewResult; SearchForPetsViewModel resultModel = result.Model as SearchForPetsViewModel; int actualNumberOfPetsInList = resultModel.ResultPetList.Count; //3. Assert Assert.Equal(expectedNumberOfPetsInList, actualNumberOfPetsInList); }