public void DB_CreateNewEntry_Test() { //Arrange AnimalsController controller = new AnimalsController(db); VeterinariansController vetController = new VeterinariansController(db2); Veterinarian testVet = new Veterinarian() { VeterinarianId = 1, Name = "Mike", Speciality = "Mice" }; Animal testAnimal = new Animal() { Name = "Momo", Species = "Spider Monkey", Sex = "Female", HabitType = "Forest", MedicalEmergency = false, VeterinarianId = 1 }; //List<Animal> expected = new List<Animal>() //{ testAnimal }; //Act vetController.Create(testVet); controller.Create(testAnimal); var collection = (controller.Index() as ViewResult).ViewData.Model as List <Animal>; //Assert CollectionAssert.Contains(collection, testAnimal); }
public void DB_Edit_test() { AnimalsController animalController = new AnimalsController(db); VeterinariansController vetController = new VeterinariansController(db2); Veterinarian testVet = new Veterinarian("Jesse", "Elephants"); testVet.VeterinarianId = 1; Animal testAnimal = new Animal(); testAnimal.AnimalId = 1; testAnimal.Name = "Ellie"; testAnimal.Species = "Elephant"; testAnimal.Sex = "Female"; testAnimal.HabitatType = "Savanna"; testAnimal.MedicalEmergency = false; testAnimal.VeterinarianId = 1; vetController.Create(testVet); animalController.Create(testAnimal); testAnimal.Name = "Eli"; animalController.Edit(testAnimal); var collection = (animalController.Index() as ViewResult).ViewData.Model as List <Animal>; Assert.AreEqual(testAnimal.Name, "Eli"); }
public void DB_CreateNewEntry_test() { VeterinariansController controller = new VeterinariansController(db); Veterinarian testVeterinarian = new Veterinarian(); testVeterinarian.Name = "Jesse"; testVeterinarian.Specialty = "African"; controller.Create(testVeterinarian); var collection = (controller.Index() as ViewResult).ViewData.Model as List <Veterinarian>; CollectionAssert.Contains(collection, testVeterinarian); }
public void Mock_PostViewResultCreate_ViewResult() { // Arrange Veterinarian testVeterinarian = new Veterinarian { VeterinarianId = 1, Name = "Jhon" }; DbSetup(); VeterinariansController controller = new VeterinariansController(mock.Object); // Act var resultView = controller.Create(testVeterinarian) as ViewResult; // Assert Assert.IsInstanceOfType(resultView, typeof(ViewResult)); }
public void DB_CreateNewEntry_Test() { //Arrange VeterinariansController controller = new VeterinariansController(db); Veterinarian testVet = new Veterinarian() { VeterinarianId = 1, Name = "Mike", Speciality = "Mice" }; //List<Animal> expected = new List<Animal>() //{ testAnimal }; //Act controller.Create(testVet); var collection = (controller.Index() as ViewResult).ViewData.Model as List <Veterinarian>; //Assert CollectionAssert.Contains(collection, testVet); }
public void DB_CreateNewEntry_test() { AnimalsController controller = new AnimalsController(db); VeterinariansController controller1 = new VeterinariansController(db2); Veterinarian testVet = new Veterinarian("Jesse", "Elephants"); testVet.VeterinarianId = 1; Animal testAnimal = new Animal(); testAnimal.AnimalId = 1; testAnimal.Name = "Ellie"; testAnimal.Species = "Elephant"; testAnimal.Sex = "Female"; testAnimal.HabitatType = "Savanna"; testAnimal.MedicalEmergency = false; testAnimal.VeterinarianId = 1; controller1.Create(testVet); controller.Create(testAnimal); var collection = (controller.Index() as ViewResult).ViewData.Model as List <Animal>; CollectionAssert.Contains(collection, testAnimal); }