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);
        }
Example #2
0
        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");
        }
Example #3
0
        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);
        }
Example #4
0
        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));
        }
Example #5
0
        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);
        }
Example #6
0
        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);
        }