public void Test_DatabaseEmptyAtFirst() { //Arrange, ACT int result = Animal.GetAll().Count; //Assert Assert.Equal(0, result); }
public void Test_DatabaseEmptyAtFirst() { //Arrange int result = Species.GetAll().Count; int animalResult = Animal.GetAll().Count; //Assert Assert.Equal(0, animalResult + result); }
public void Test_Save_SavesToDataBase() { Animal testAnimal = new Animal("sparky", 1); testAnimal.Save(); List <Animal> result = Animal.GetAll(); List <Animal> testList = new List <Animal> { testAnimal }; Assert.Equal(testList, result); }
public void Test_Animal_Save_SaveToDataBase() { //Arrange Animal testAnimal = new Animal("06/06/2017", "Female", "Bella", 1); //Act testAnimal.Save(); List <Animal> result = Animal.GetAll(); List <Animal> testList = new List <Animal> { testAnimal }; //Assert Assert.Equal(testList, result); }
public HomeModule() { Get["/"] = _ => { return(View["index.cshtml"]); }; Get["/animals/new"] = _ => { return(View["animal_form.cshtml"]); }; Post["/animals/confirm"] = _ => { string animalName = Request.Form["animal-name"]; string animalGender = Request.Form["animal-gender"]; DateTime animalAdmittance = Request.Form["animal-admittance"]; string animalBreed = Request.Form["animal-breed"]; Animal newAnimal = new Animal(animalName, animalGender, animalAdmittance, animalBreed); newAnimal.Save(); return(View["animal_confirmation.cshtml", newAnimal]); }; Get["/animals"] = _ => { List <Animal> allAnimals = Animal.GetAll(); return(View["animals.cshtml", allAnimals]); }; Get["/animals/delete"] = _ => { Animal.DeleteAll(); return(View["animal_deleted.cshtml"]); }; Get["/types/new"] = _ => { return(View["type_form.cshtml"]); }; Post["/types/confirm"] = _ => { return(View["type_confirmation.cshtml"]); }; Get["/types"] = _ => { List <AnimalType> types = AnimalType.GetAll(); return(View["types.cshtml", types]); }; Get["/types/{id}"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object>(); AnimalType selectedAnimalType = AnimalType.Find(parameters.id); List <Animal> selectedAnimals = selectedAnimalType.GetAnimals(); model.Add("animal type", selectedAnimalType); model.Add("animals", selectedAnimals); return(["type.cshtml", model]); };