示例#1
0
        public void GetAll_VetsEmptyAtFirst_List()
        {
            //Arrange, Act
            int result = Vet.GetAll().Count;

            //Assert
            Assert.AreEqual(0, result);
        }
示例#2
0
        public ActionResult Create(string vetName, string vetSpecialty)
        {
            Vet newVet = new Vet(vetName, vetSpecialty);

            newVet.Save();
            List <Vet> allVets = Vet.GetAll();

            return(View("Index", allVets));
        }
示例#3
0
        public ActionResult Show(int id)
        {
            Dictionary <string, object> model = new Dictionary <string, object>();
            Patient    selectedPatient        = Patient.Find(id);
            List <Vet> patientVets            = selectedPatient.GetVets();
            List <Vet> allVets = Vet.GetAll();

            model.Add("selectedPatient", selectedPatient);
            model.Add("patientVets", patientVets);
            model.Add("allVets", allVets);
            return(View(model));
        }
示例#4
0
        public void Save_DatabaseAssignsIdToVet_Id()
        {
            //Arrange
            Vet testVet = new Vet("Doctor Phil", "Headstuff");

            testVet.Save();

            //Act
            Vet savedVet = Vet.GetAll()[0];

            int result = savedVet.Id;
            int testId = testVet.Id;

            //Assert
            Assert.AreEqual(testId, result);
        }
示例#5
0
        public void Save_SavesVetToDatabase_VetList()
        {
            //Arrange
            Vet testVet = new Vet("Doctor Phil", "Headstuff");

            testVet.Save();

            //Act
            List <Vet> result   = Vet.GetAll();
            List <Vet> testList = new List <Vet> {
                testVet
            };

            //Assert
            CollectionAssert.AreEqual(testList, result);
        }
示例#6
0
        public void GetAll_ReturnsAllVetObjects_VetList()
        {
            //Arrange
            Vet newVet1 = new Vet("Doctor Bill", "Buttstuff");

            newVet1.Save();
            Vet newVet2 = new Vet("Doctor Phil", "Headstuff");

            newVet2.Save();
            List <Vet> newList = new List <Vet> {
                newVet1, newVet2
            };

            //Act
            List <Vet> result = Vet.GetAll();

            //Assert
            CollectionAssert.AreEqual(newList, result);
        }
示例#7
0
        public ActionResult Index()
        {
            List <Vet> allVets = Vet.GetAll();

            return(View(allVets));
        }