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);
        }
Beispiel #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");
        }
Beispiel #3
0
        public void Mock_IndexListOfAnimals_Test()
        {
            DbSetup();
            //Arrange
            ViewResult indexView = new VeterinariansController(mock.Object).Index() as ViewResult;
            //Act
            var result = indexView.ViewData.Model;

            //Assert
            Assert.IsInstanceOfType(result, typeof(List <Veterinarian>));
        }
Beispiel #4
0
        public void Mock_GetViewResultIndex_Test()
        {
            DbSetup();
            //Arrange
            VeterinariansController controller = new VeterinariansController(mock.Object);
            //Act
            var result = controller.Index();

            //Assert
            Assert.IsInstanceOfType(result, typeof(ActionResult));
        }
Beispiel #5
0
        public void Mock_IndexContainsModelData_List() // Confirms model as list of veterns
        {
            // Arrange
            DbSetup();
            ViewResult indexView = new VeterinariansController(mock.Object).Index() as ViewResult;

            // Act
            var result = indexView.ViewData.Model;

            // Assert
            Assert.IsInstanceOfType(result, typeof(List <Veterinarian>));
        }
Beispiel #6
0
        public void Mock_GetViewResultIndex_ActionResult() // Confirms route returns view
        {
            //Arrange
            DbSetup();
            VeterinariansController controller = new VeterinariansController(mock.Object);

            //Act
            var result = controller.Index();

            //Assert
            Assert.IsInstanceOfType(result, typeof(ActionResult));
        }
Beispiel #7
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);
        }
Beispiel #8
0
        public void Mock_ConfirmEntry_Test()
        {
            DbSetup();
            VeterinariansController controller = new VeterinariansController(mock.Object);
            Veterinarian            testVet    = new Veterinarian();

            testVet.Name           = "Mike";
            testVet.Speciality     = "Mice";
            testVet.VeterinarianId = 1;


            ViewResult indexView  = controller.Index() as ViewResult;
            var        collection = indexView.ViewData.Model as List <Veterinarian>;

            CollectionAssert.Contains(collection, testVet);
        }
        public void Mock_ConfirmEntry_Test()
        {
            //Arrange
            DbSetup();
            VeterinariansController controller       = new VeterinariansController(mock.Object);
            Veterinarian            testVeterinarian = new Veterinarian();

            testVeterinarian.Name           = "Tessie";
            testVeterinarian.VeterinarianId = 1;

            //Act
            ViewResult indexView  = controller.Index() as ViewResult;
            var        collection = indexView.ViewData.Model as List <Veterinarian>;

            //Assert
            CollectionAssert.Contains(collection, testVeterinarian);
        }
Beispiel #10
0
        public void Mock_IndexModelContainsAnimals_Collection() // Confirms presence of known entry
        {
            // Arrange
            DbSetup();
            VeterinariansController controller       = new VeterinariansController(mock.Object);
            Veterinarian            testVeterinarian = new Veterinarian();

            testVeterinarian.Name           = "Jhon";
            testVeterinarian.VeterinarianId = 1;
            testVeterinarian.Specialty      = "petCare";

            // Act
            ViewResult          indexView  = controller.Index() as ViewResult;
            List <Veterinarian> collection = indexView.ViewData.Model as List <Veterinarian>;

            // Assert
            CollectionAssert.Contains(collection, testVeterinarian);
        }
Beispiel #11
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));
        }
Beispiel #12
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);
        }
Beispiel #13
0
        public void Mock_GetDetails_ReturnsView()
        {
            // Arrange
            Veterinarian testVeterinarian = new Veterinarian
            {
                VeterinarianId = 4,
                Name           = "donkey"
            };

            DbSetup();
            VeterinariansController controller = new VeterinariansController(mock.Object);

            // Act
            var resultView = controller.Details(testVeterinarian.VeterinarianId) as ViewResult;
            var model      = resultView.ViewData.Model as Veterinarian;

            // Assert
            Assert.IsInstanceOfType(resultView, typeof(ViewResult));
            Assert.IsInstanceOfType(model, typeof(Veterinarian));
        }
Beispiel #14
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);
        }