public void SearchShouldWorkProperly() { var model = new SearchDogViewModel { Province = Province.SofiaCityProvince, Breed = DogBreed.Affenpinscher, IsDisinfected = false, IsVaccinated = false, HasVetNotes = false, MaxAge = 20, MinAge = 0 }; var result = dogsController.Search(model) as ViewResult; var res = result.Model as List <DogViewModel>; Assert.IsInstanceOf <List <DogViewModel> >(res); Assert.AreEqual(0, res.Count); this.createDog.Name = "Pavel"; this.createDog.Breed = DogBreed.Affenpinscher; this.createDog.BirthDate = DateTime.Parse("20.01.2019"); this.createDog.Province = Province.SofiaCityProvince; this.createDog.IsDisinfected = false; this.createDog.IsVaccinated = true; this.dogsController.New(this.createDog); var resultat = dogsController.Search(model) as ViewResult; var final = resultat.Model as List <DogViewModel>; Assert.AreEqual(1, final.Count); Assert.AreEqual("Pavel", final.First().Name); Assert.AreEqual("SearchResults", resultat.ViewName); model.IsDisinfected = true; var newResult = dogsController.Search(model) as ViewResult; var newRes = newResult.Model as List <DogViewModel>; Assert.AreEqual(0, newRes.Count); }