public void ShouldListAllPets() { //AAA //1. Arrange //ApplicationDbContext database = null; (Controller does not use / depend on database) mockPetRepo = new Mock <IPetRepo>(); List <Pet> mockPets = CreateMockPetData(); mockPetRepo.Setup(m => m.ListAllPets()).Returns(mockPets); int expectedNumberOfPetsInList = 4; PetController petController = new PetController(mockPetRepo.Object);//database); //2. Action ViewResult result = petController.ListAllPets() as ViewResult; //I know that the resulting datatype is a viewresult (casting) List <Pet> resultModel = result.Model as List <Pet>; int actualNumberOfPetsInList = resultModel.Count; //3. Assert (comparing: Expecting v Actual) Assert.Equal(expectedNumberOfPetsInList, actualNumberOfPetsInList); }