示例#1
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));
        }
示例#2
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));
        }
示例#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);
        }
示例#4
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);
        }
示例#6
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);
        }
示例#7
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);
        }