コード例 #1
0
        public void DeleteSpecialty()
        {
            CreatedAtRouteNegotiatedContentResult<SpecialtyModel> contentResult;

            using (var SpecialtyController = new SpecialtiesController())
            {
                //Creat Exam Room
                var newSpecialty = new SpecialtyModel
                {
                    SpecialtyName = "Testologist"
                };
                //Insert ExamRoomModelObject into Database so
                //that I can take it out and test for update.
                var result = SpecialtyController.PostSpecialty(newSpecialty);

                //Cast result as Content Result so that I can gather information from ContentResult
                contentResult = (CreatedAtRouteNegotiatedContentResult<SpecialtyModel>)result;
            }
            using (var SecondSpecialtyController = new SpecialtiesController())
            {
                //Delete the Test Exam Room
                var result = SecondSpecialtyController.DeleteSpecialty(contentResult.Content.SpecialtyID);

                //Assert
                Assert.IsInstanceOfType(result, typeof(OkNegotiatedContentResult<SpecialtyModel>));
            }
            using (var ThirdSpecialtyController = new SpecialtiesController())
            {
                var result = ThirdSpecialtyController.GetSpecialty(contentResult.Content.SpecialtyID);

                //Assert
                Assert.IsInstanceOfType(result, typeof(NotFoundResult));
            }
        }
コード例 #2
0
        public IHttpActionResult PostSpecialty(SpecialtyModel specialty)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }
            var dbSpecialty = new Specialty();

            dbSpecialty.Update(specialty);
            db.Specialties.Add(dbSpecialty);
            try
            {
                db.SaveChanges();
            }
            catch (Exception)
            {
                throw new Exception("Unable to add the specialty to the database");
            }
            specialty.SpecialtyID = dbSpecialty.SpecialtyID;

            return CreatedAtRoute("DefaultApi", new { id = specialty.SpecialtyID }, specialty);
        }
コード例 #3
0
        public void PutDoctorUpdateDoctor()
        {
            //Test Properties
            IHttpActionResult result;
            CreatedAtRouteNegotiatedContentResult<DoctorModel> contentResult;
            OkNegotiatedContentResult<DoctorModel> doctorResult;
            OkNegotiatedContentResult<DoctorModel> readContentResult;
            int createdSpecialtyID;

            //Arrange
            // Create a new test specialty, and get its specialty ID
            using (var specialtyController = new SpecialtiesController())
            {
                var specialty = new SpecialtyModel
                {
                    SpecialtyName = "Very Special Doctor"
                };
                result = specialtyController.PostSpecialty(specialty);
                CreatedAtRouteNegotiatedContentResult<SpecialtyModel> specialtyContentResult =
                    (CreatedAtRouteNegotiatedContentResult<SpecialtyModel>)result;
                createdSpecialtyID = specialtyContentResult.Content.SpecialtyID;
            }

            using (var DoctorController = new DoctorsController())
            {
                //Create Doctor
                var newDoctor = new DoctorModel
                {
                    FirstName = "Alex",
                    LastName = "Smith",
                    Email = "*****@*****.**",
                    SpecialtyID = createdSpecialtyID,
                    Telephone = "111-111-1111",
                    CreatedDate = DateTime.Today
                };
                //Insert DoctorModelObject into Database so
                //that I can take it out and test for update.
                result = DoctorController.PostDoctor(newDoctor);

                //Cast result as Content Result so that I can gather information from ContentResult
                contentResult = (CreatedAtRouteNegotiatedContentResult<DoctorModel>)result;
            }

            using (var SecondDoctorController = new DoctorsController())
            {
                //Result contains the Doctor I had JUST createad
                result = SecondDoctorController.GetDoctor(contentResult.Content.DoctorID);

                Assert.IsInstanceOfType(result, typeof(OkNegotiatedContentResult<DoctorModel>));

                //Get DoctorModel from 'result'
                doctorResult = (OkNegotiatedContentResult<DoctorModel>)result;

            }

            using (var ThirdDoctorController = new DoctorsController())
            {
                var modifiedDoctor = doctorResult.Content;

                modifiedDoctor.FirstName = "John";

                //Act
                //The result of the Put Request
                result = ThirdDoctorController.PutDoctor(doctorResult.Content.DoctorID, modifiedDoctor);

                //Assert
                Assert.IsInstanceOfType(result, typeof(StatusCodeResult));
            }

            using (var FourthDoctorController = new DoctorsController())
            {
                //Act
                IHttpActionResult resultAlteredDoctor = FourthDoctorController.GetDoctor(doctorResult.Content.DoctorID);

                OkNegotiatedContentResult<DoctorModel> alteredResult = (OkNegotiatedContentResult<DoctorModel>)resultAlteredDoctor;
                DoctorModel updatedDoctor = (DoctorModel)alteredResult.Content;

                //Assert
                Assert.IsInstanceOfType(resultAlteredDoctor, typeof(OkNegotiatedContentResult<DoctorModel>));

                readContentResult = (OkNegotiatedContentResult<DoctorModel>)resultAlteredDoctor;

                Assert.IsTrue(readContentResult.Content.FirstName == "John");
            }

            // Remove the test doctor from the database with actual deletion, not archiving
            using (MedAgendaDbContext db = new MedAgendaDbContext())
            {
                Doctor dbDoctor = db.Doctors.Find(readContentResult.Content.DoctorID);
                db.Doctors.Remove(dbDoctor);
                db.SaveChanges();
            }

            // Delete the test specialty
            using (var specialtyController = new SpecialtiesController())
            {
                result = specialtyController.DeleteSpecialty(createdSpecialtyID);
            }
        }
コード例 #4
0
        public void DeleteDoctor()
        {
            int doctorIDForTest;
            int createdSpecialtyID;

            IHttpActionResult result;
            CreatedAtRouteNegotiatedContentResult<DoctorModel> createdContentResult;
            OkNegotiatedContentResult<DoctorModel> OkcontentResult;

            //Arrange
            // Create a new test specialty, and get its specialty ID
            using (var specialtyController = new SpecialtiesController())
            {
                var specialty = new SpecialtyModel
                {
                    SpecialtyName = "Very Special Doctor"
                };
                result = specialtyController.PostSpecialty(specialty);
                CreatedAtRouteNegotiatedContentResult<SpecialtyModel> specialtyContentResult =
                    (CreatedAtRouteNegotiatedContentResult<SpecialtyModel>)result;
                createdSpecialtyID = specialtyContentResult.Content.SpecialtyID;
            }

            // Create a new test doctor, and get its doctor ID
            using (var DoctorController = new DoctorsController())
            {
                var newDoctor = new DoctorModel
                {
                    FirstName = "Alex",
                    LastName = "Smith",
                    Email = "*****@*****.**",
                    SpecialtyID = createdSpecialtyID,
                    Telephone = "111-111-1111",
                    CreatedDate = DateTime.Today
                };
                result = DoctorController.PostDoctor(newDoctor);
                createdContentResult =
                    (CreatedAtRouteNegotiatedContentResult<DoctorModel>)result;
                doctorIDForTest = createdContentResult.Content.DoctorID;
            }

            //Call the procedure to delete the doctor, which sets its archived indicator to true
            using (var docController = new DoctorsController())
            {
                result = docController.DeleteDoctor(doctorIDForTest);

                // Verify that HTTP result is OK
                Assert.IsInstanceOfType(result, typeof(OkNegotiatedContentResult<DoctorModel>));
                // Verify that the returned DoctorModel object has archived indicator set to true
                OkcontentResult =
                    (OkNegotiatedContentResult<DoctorModel>)result;
                Assert.IsTrue(OkcontentResult.Content.Archived);
            }

            // Get the doctor and verify that the doctor has archived indicator set to true
            using (var DocController = new DoctorsController())
            {
                result = DocController.GetDoctor(doctorIDForTest);
                Assert.IsInstanceOfType(result, typeof(OkNegotiatedContentResult<DoctorModel>));
                OkcontentResult =
                    (OkNegotiatedContentResult<DoctorModel>)result;
                Assert.IsTrue(OkcontentResult.Content.Archived);
            }

            // Remove the doctor from the database with actual deletion, not archiving
            using (MedAgendaDbContext db = new MedAgendaDbContext())
            {
                Doctor dbDoctor = db.Doctors.Find(doctorIDForTest);
                db.Doctors.Remove(dbDoctor);
                db.SaveChanges();
            }

            // Delete the test specialty
            using (var specialtyController = new SpecialtiesController())
            {
                result = specialtyController.DeleteSpecialty(createdSpecialtyID);
            }
        }
コード例 #5
0
        public void PostDoctorCreateDoctor()
        {
            CreatedAtRouteNegotiatedContentResult<DoctorModel> contentResult;
            int createdSpecialtyID;

            //Arrange
            // Create a new test specialty, and get its specialty ID
            using (var specialtyController = new SpecialtiesController())
            {
                var specialty = new SpecialtyModel
                {
                    SpecialtyName = "Very Special Doctor"
                };
                IHttpActionResult result = specialtyController.PostSpecialty(specialty);
                CreatedAtRouteNegotiatedContentResult<SpecialtyModel> specialtyContentResult =
                    (CreatedAtRouteNegotiatedContentResult<SpecialtyModel>)result;
                createdSpecialtyID = specialtyContentResult.Content.SpecialtyID;
            }

            using (var DoctorController = new DoctorsController())
            {
                //Create Doctor
                var newDoctor = new DoctorModel
                {
                    FirstName = "Alex",
                    LastName = "Smith",
                    Email = "*****@*****.**",
                    SpecialtyID = createdSpecialtyID,
                    Telephone = "111-111-1111",
                    CreatedDate = DateTime.Today
                };

                //Act
                IHttpActionResult result = DoctorController.PostDoctor(newDoctor);

                //Assert
                Assert.IsInstanceOfType(result, typeof(CreatedAtRouteNegotiatedContentResult<DoctorModel>));

                 contentResult = (CreatedAtRouteNegotiatedContentResult<DoctorModel>)result;

                Assert.IsTrue(contentResult.Content.DoctorID != 0);
            }

            // Remove the test doctor from the database with actual deletion, not archiving
            using (MedAgendaDbContext db = new MedAgendaDbContext())
            {
                Doctor dbDoctor = db.Doctors.Find(contentResult.Content.DoctorID);
                db.Doctors.Remove(dbDoctor);
                db.SaveChanges();
            }

            // Delete the test specialty
            using (var specialtyController = new SpecialtiesController())
            {
                IHttpActionResult result = specialtyController.DeleteSpecialty(createdSpecialtyID);
            }
        }
コード例 #6
0
        public void GetDoctorReturnDoctor()
        {
            int createdSpecialtyID;
            int createdDoctorID;
            //Arrange: create test specialty and doctor
            // Create a new test specialty, and get its specialty ID
            using (var specialtyController = new SpecialtiesController())
            {
                var specialty = new SpecialtyModel
                {
                    SpecialtyName = "Very Special Doctor"
                };
                IHttpActionResult result = specialtyController.PostSpecialty(specialty);
                CreatedAtRouteNegotiatedContentResult<SpecialtyModel> specialtyContentResult =
                    (CreatedAtRouteNegotiatedContentResult<SpecialtyModel>)result;
                createdSpecialtyID = specialtyContentResult.Content.SpecialtyID;
            }

            // Create a new test doctor, and get its doctor ID
            using (var doctorController = new DoctorsController())
            {
                var doctor = new DoctorModel
                {
                    FirstName = "Imdoctor",
                    LastName = "Hippocrates",
                    Email = "*****@*****.**",
                    Telephone = "555-1212",
                    CreatedDate = DateTime.Now,
                    SpecialtyID = createdSpecialtyID,
                    Archived = false
                };
                IHttpActionResult result = doctorController.PostDoctor(doctor);
                CreatedAtRouteNegotiatedContentResult<DoctorModel> doctorContentResult =
                    (CreatedAtRouteNegotiatedContentResult<DoctorModel>)result;
                createdDoctorID = doctorContentResult.Content.DoctorID;
            }

            using (var doctorController = new DoctorsController())
            {
                //Act
                IHttpActionResult result = doctorController.GetDoctor(createdDoctorID);

                //Assert
                Assert.IsInstanceOfType(result, typeof(OkNegotiatedContentResult<DoctorModel>));

                OkNegotiatedContentResult<DoctorModel> contentResult = (OkNegotiatedContentResult<DoctorModel>)result;

                Assert.IsTrue(contentResult.Content.DoctorID == createdDoctorID);
            }

            // Remove the test doctor from the database with actual deletion, not archiving
            using (MedAgendaDbContext db = new MedAgendaDbContext())
            {
                Doctor dbDoctor = db.Doctors.Find(createdDoctorID);
                db.Doctors.Remove(dbDoctor);
                db.SaveChanges();
            }

            // Delete the test specialty
            using (var specialtyController = new SpecialtiesController())
            {
                IHttpActionResult result = specialtyController.DeleteSpecialty(createdSpecialtyID);
            }
        }
コード例 #7
0
        public void GetSpecialtyReturnSpecialty()
        {
            int specialtyIDForTest;

            //Arrange: create test specialty
            // Create a new test specialty, and get its specialty ID
            using (var specialtyController = new SpecialtiesController())
            {
                var specialty = new SpecialtyModel
                {
                    SpecialtyName = "Very Special Doctor"
                };
                IHttpActionResult result = specialtyController.PostSpecialty(specialty);
                CreatedAtRouteNegotiatedContentResult<SpecialtyModel> specialtyContentResult =
                    (CreatedAtRouteNegotiatedContentResult<SpecialtyModel>)result;
                specialtyIDForTest = specialtyContentResult.Content.SpecialtyID;
            }

            using (var specialtyController = new SpecialtiesController())
            {
                //Act
                IHttpActionResult result = specialtyController.GetSpecialty(specialtyIDForTest);

                //Assert
                Assert.IsInstanceOfType(result, typeof(OkNegotiatedContentResult<SpecialtyModel>));
                     OkNegotiatedContentResult<SpecialtyModel> contentResult = (OkNegotiatedContentResult<SpecialtyModel>)result;

                Assert.IsTrue(contentResult.Content.SpecialtyID == specialtyIDForTest);
            }

            // Delete the test specialty
            using (var specialtyController = new SpecialtiesController())
            {
                IHttpActionResult result = specialtyController.DeleteSpecialty(specialtyIDForTest);
            }
        }
コード例 #8
0
        public void PostDoctorCheckCreatesDoctorCheck()
        {
            int createdDoctorID;
            int createdExamRoomID;
            int createdSpecialtyID;
            int doctorCheckIDForTest;
            IHttpActionResult result;

            //Arrange: create test specialty, doctor, and exam room
            // Create a new test specialty, and get its specialty ID
            using (var specialtyController = new SpecialtiesController())
            {
                var specialty = new SpecialtyModel
                {
                    SpecialtyName = "Very Special Doctor"
                };
                result = specialtyController.PostSpecialty(specialty);
                CreatedAtRouteNegotiatedContentResult<SpecialtyModel> specialtyContentResult =
                    (CreatedAtRouteNegotiatedContentResult<SpecialtyModel>)result;
                createdSpecialtyID = specialtyContentResult.Content.SpecialtyID;
            }

            // Create a new test doctor, and get its doctor ID
            using (var doctorController = new DoctorsController())
            {
                var doctor = new DoctorModel
                {
                    FirstName = "Imdoctor",
                    LastName = "Hippocrates",
                    Email = "*****@*****.**",
                    Telephone = "555-1212",
                    CreatedDate = DateTime.Now,
                    SpecialtyID = createdSpecialtyID,
                    Archived = false
                };
                result = doctorController.PostDoctor(doctor);
                CreatedAtRouteNegotiatedContentResult<DoctorModel> doctorContentResult =
                    (CreatedAtRouteNegotiatedContentResult<DoctorModel>)result;
                createdDoctorID = doctorContentResult.Content.DoctorID;
            }

            // Create a new test exam room, and get its exam room ID
            using (var examRoomController = new ExamRoomsController())
            {
                var examRoom = new ExamRoomModel
                {
                    ExamRoomName = "ImexamRoom"
                };
                result = examRoomController.PostExamRoom(examRoom);
                CreatedAtRouteNegotiatedContentResult<ExamRoomModel> examRoomContentResult =
                    (CreatedAtRouteNegotiatedContentResult<ExamRoomModel>)result;
                createdExamRoomID = examRoomContentResult.Content.ExamRoomID;
            }

            //Arrange: Instantiate DoctorCheckController so its methods can be called
            using (var doctorCheckController = new DoctorsCheckController())
            {
                //Act:
                // Create a DcotorCheckModel object populated with test data,
                //  and call PostDoctorCheck
                var newDoctorCheck = new DoctorCheckModel
                {
                    DoctorID = createdDoctorID,
                    ExamRoomID = createdExamRoomID,
                    CheckinDateTime = DateTime.Now,
                    CheckoutDateTime = DateTime.Now.AddHours(2)
                };
                result = doctorCheckController.PostDoctorCheck(newDoctorCheck);

                //Assert:
                // Verify that the HTTP result is CreatedAtRouteNegotiatedContentResult
                // Verify that the HTTP result body contains a nonzero doctorCheck ID
                Assert.IsInstanceOfType
                    (result, typeof(CreatedAtRouteNegotiatedContentResult<DoctorCheckModel>));
                CreatedAtRouteNegotiatedContentResult<DoctorCheckModel> contentResult =
                    (CreatedAtRouteNegotiatedContentResult<DoctorCheckModel>)result;
                Assert.IsTrue(contentResult.Content.DoctorCheckID != 0);
                doctorCheckIDForTest = contentResult.Content.DoctorCheckID;
            }

            // Delete the test doctorCheck
            using (var doctorCheckController = new DoctorsCheckController())
            {
                result = doctorCheckController.DeleteDoctorCheck(doctorCheckIDForTest);
            }

            // Remove the test doctor from the database with actual deletion, not archiving
            using (MedAgendaDbContext db = new MedAgendaDbContext())
            {
                Doctor dbDoctor = db.Doctors.Find(createdDoctorID);
                db.Doctors.Remove(dbDoctor);
                db.SaveChanges();
            }

            // Delete the test exam room
            using (var SecondExamRoomController = new ExamRoomsController())
            {
                result = SecondExamRoomController.DeleteExamRoom(createdExamRoomID);
            }

            // Delete the test specialty
            using (var specialtyController = new SpecialtiesController())
            {
                result = specialtyController.DeleteSpecialty(createdSpecialtyID);
            }
        }
コード例 #9
0
        public void PostSpecialtyCreateSpecialty()
        {
            //Arrange
            using (var SpecialtyController = new SpecialtiesController())
            {
                //Create Specialty
                var newSpecialty = new SpecialtyModel
                {
                    SpecialtyName = "Testologist",
                };

                //Act
                IHttpActionResult result = SpecialtyController.PostSpecialty(newSpecialty);

                //Assert
                Assert.IsInstanceOfType(result, typeof(CreatedAtRouteNegotiatedContentResult<SpecialtyModel>));

                CreatedAtRouteNegotiatedContentResult<SpecialtyModel> contentResult = (CreatedAtRouteNegotiatedContentResult<SpecialtyModel>)result;

                Assert.IsTrue(contentResult.Content.SpecialtyID != 0);

                //Delete the test Specialty
                result = SpecialtyController.DeleteSpecialty(contentResult.Content.SpecialtyID);
            }
        }
コード例 #10
0
        public IHttpActionResult PutSpecialty(int id, SpecialtyModel specialty)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != specialty.SpecialtyID)
            {
                return BadRequest();
            }

            var dbSpecialty = db.Specialties.Find(id);

            dbSpecialty.Update(specialty);

            db.Entry(dbSpecialty).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SpecialtyExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw new Exception("Unable to update the specialty in the database");
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
コード例 #11
0
        public void PutAppointmentReturnAppointment()
        {
            //Test Properties
            IHttpActionResult result;
            CreatedAtRouteNegotiatedContentResult<AppointmentModel> contentResult;
            OkNegotiatedContentResult<AppointmentModel> appointmentResult;
            OkNegotiatedContentResult<AppointmentModel> readContentResult;

            int createdPatientID;
            int createdDoctorID;
            int createdExamRoomID;
            int changedExamRoomID;
            int createdSpecialtyID;

            //Arrange: create test patient, specialty, doctor, exam rooms, and appointment
            // Create a new test patient, and get its patient ID
            using (var patientController = new PatientsController())
            {
                var patient = new PatientModel
                {
                    FirstName = "Impatient",
                    LastName = "Patience",
                    Birthdate = new DateTime(1968, 12, 27),
                    Email = "*****@*****.**",
                    BloodType = "A+",
                    CreatedDate = DateTime.Now,
                    Archived = false
                };
                result = patientController.PostPatient(patient);
                CreatedAtRouteNegotiatedContentResult<PatientModel> patientContentResult =
                    (CreatedAtRouteNegotiatedContentResult<PatientModel>)result;
                createdPatientID = patientContentResult.Content.PatientID;
            }

            // Create a new test specialty, and get its specialty ID
            using (var specialtyController = new SpecialtiesController())
            {
                var specialty = new SpecialtyModel
                {
                    SpecialtyName = "Very Special Doctor"
                };
                result = specialtyController.PostSpecialty(specialty);
                CreatedAtRouteNegotiatedContentResult<SpecialtyModel> specialtyContentResult =
                    (CreatedAtRouteNegotiatedContentResult<SpecialtyModel>)result;
                createdSpecialtyID = specialtyContentResult.Content.SpecialtyID;
            }

            // Create a new test doctor, and get its doctor ID
            using (var doctorController = new DoctorsController())
            {
                var doctor = new DoctorModel
                {
                    FirstName = "Imdoctor",
                    LastName = "Hippocrates",
                    Email = "*****@*****.**",
                    Telephone = "555-1212",
                    CreatedDate = DateTime.Now,
                    SpecialtyID = createdSpecialtyID,
                    Archived = false
                };
                result = doctorController.PostDoctor(doctor);
                CreatedAtRouteNegotiatedContentResult<DoctorModel> doctorContentResult =
                    (CreatedAtRouteNegotiatedContentResult<DoctorModel>)result;
                createdDoctorID = doctorContentResult.Content.DoctorID;
            }

            // Create new test exam rooms, and get the exam room IDs
            using (var examRoomController = new ExamRoomsController())
            {
                var examRoom = new ExamRoomModel
                {
                    ExamRoomName = "ImexamRoom"
                };
                result = examRoomController.PostExamRoom(examRoom);
                CreatedAtRouteNegotiatedContentResult<ExamRoomModel> examRoomContentResult =
                    (CreatedAtRouteNegotiatedContentResult<ExamRoomModel>)result;
                createdExamRoomID = examRoomContentResult.Content.ExamRoomID;
            }

            using (var examRoomController = new ExamRoomsController())
            {
                var examRoom = new ExamRoomModel
                {
                    ExamRoomName = "AnotherexamRoom"
                };
                result = examRoomController.PostExamRoom(examRoom);
                CreatedAtRouteNegotiatedContentResult<ExamRoomModel> examRoomContentResult =
                    (CreatedAtRouteNegotiatedContentResult<ExamRoomModel>)result;
                changedExamRoomID = examRoomContentResult.Content.ExamRoomID;
            }

            using (var apptController = new AppointmentsController())
            {
                //Create Appointment
                var newAppt = new AppointmentModel
                {
                    DoctorID = createdDoctorID,
                    CheckinDateTime = DateTime.Now,
                    CheckoutDateTime = DateTime.Now.AddHours(2),
                    ExamRoomID = createdExamRoomID,
                    PatientID = createdPatientID
                };

                //Insert Appointment Model Object into Database
                //So that I can take it out and test for update
                result = apptController.PostAppointment(newAppt);

                //Cast result as Content Result so that I can gather information from Content Result
                contentResult = (CreatedAtRouteNegotiatedContentResult<AppointmentModel>)result;
            }

            using (var SecondAppointmentController = new AppointmentsController())
            {
                //Result contains the Appoint I have JUST creatd
                result = SecondAppointmentController.GetAppointment(contentResult.Content.AppointmentID);

                Assert.IsInstanceOfType(result, typeof(OkNegotiatedContentResult<AppointmentModel>));

                //Get AppointmentModel from 'result'
                appointmentResult = (OkNegotiatedContentResult<AppointmentModel>)result;
            }

            using (var ThirdAppointmentController = new AppointmentsController())
            {
                var modifiedAppointment = appointmentResult.Content;

                modifiedAppointment.ExamRoomID = changedExamRoomID;

                //Act
                //The result of the PUT request
                result = ThirdAppointmentController.PutAppointment(appointmentResult.Content.AppointmentID, modifiedAppointment);

                //Assert
                Assert.IsInstanceOfType(result, typeof(StatusCodeResult));
            }

            //Modify Appointment
            using (var FourthAppointmentController = new AppointmentsController())
            {
                IHttpActionResult resultAlteredAppointment = FourthAppointmentController.GetAppointment(appointmentResult.Content.AppointmentID);

                OkNegotiatedContentResult<AppointmentModel> alteredResult = (OkNegotiatedContentResult<AppointmentModel>)resultAlteredAppointment;
                AppointmentModel updatedAppointment = (AppointmentModel)alteredResult.Content;

                //Assert
                Assert.IsInstanceOfType(resultAlteredAppointment, typeof(OkNegotiatedContentResult<AppointmentModel>));

                readContentResult = (OkNegotiatedContentResult<AppointmentModel>)resultAlteredAppointment;

                Assert.IsTrue(readContentResult.Content.ExamRoomID == changedExamRoomID);
            }

            using (var fifthAppointmentController = new AppointmentsController())
            {
                //Delete test Appointment
                result = fifthAppointmentController.DeleteAppointment(readContentResult.Content.AppointmentID);
            }

            // Remove the test doctor and patient from the database with actual deletion, not archiving
            using (MedAgendaDbContext db = new MedAgendaDbContext())
            {
                Doctor dbDoctor = db.Doctors.Find(createdDoctorID);
                db.Doctors.Remove(dbDoctor);
                Patient dbPatient = db.Patients.Find(createdPatientID);
                db.Patients.Remove(dbPatient);
                db.SaveChanges();
            }

            // Delete the test exam rooms
            using (var SecondExamRoomController = new ExamRoomsController())
            {
                result = SecondExamRoomController.DeleteExamRoom(createdExamRoomID);
            }
            using (var SecondExamRoomController = new ExamRoomsController())
            {
                result = SecondExamRoomController.DeleteExamRoom(changedExamRoomID);
            }

            // Delete the test specialty
            using (var specialtyController = new SpecialtiesController())
            {
                result = specialtyController.DeleteSpecialty(createdSpecialtyID);
            }
        }
コード例 #12
0
        public void PostAppointmentCreateAppointment()
        {
            int createdPatientID;
            int appointmentIDForTest;
            int createdDoctorID;
            int createdExamRoomID;
            int createdSpecialtyID;
            CreatedAtRouteNegotiatedContentResult<AppointmentModel> contentResult;

            //Create test patient, specialty, doctor, and exam room for appointment
            // Create a new test patient, and get its patient ID
            using (var patientController = new PatientsController())
            {
                var patient = new PatientModel
                {
                    FirstName = "Impatient",
                    LastName = "Patience",
                    Birthdate = new DateTime(1968, 12, 27),
                    Email = "*****@*****.**",
                    BloodType = "A+",
                    CreatedDate = DateTime.Now,
                    Archived = false
                };
                IHttpActionResult result = patientController.PostPatient(patient);
                CreatedAtRouteNegotiatedContentResult<PatientModel> patientContentResult =
                    (CreatedAtRouteNegotiatedContentResult<PatientModel>)result;
                createdPatientID = patientContentResult.Content.PatientID;
            }

            // Create a new test specialty, and get its specialty ID
            using (var specialtyController = new SpecialtiesController())
            {
                var specialty = new SpecialtyModel
                {
                    SpecialtyName = "Very Special Doctor"
                };
                IHttpActionResult result = specialtyController.PostSpecialty(specialty);
                CreatedAtRouteNegotiatedContentResult<SpecialtyModel> specialtyContentResult =
                    (CreatedAtRouteNegotiatedContentResult<SpecialtyModel>)result;
                createdSpecialtyID = specialtyContentResult.Content.SpecialtyID;
            }

            // Create a new test doctor, and get its doctor ID
            using (var doctorController = new DoctorsController())
            {
                var doctor = new DoctorModel
                {
                    FirstName = "Imdoctor",
                    LastName = "Hippocrates",
                    Email = "*****@*****.**",
                    Telephone = "555-1212",
                    CreatedDate = DateTime.Now,
                    SpecialtyID = createdSpecialtyID,
                    Archived = false
                };
                IHttpActionResult result = doctorController.PostDoctor(doctor);
                CreatedAtRouteNegotiatedContentResult<DoctorModel> doctorContentResult =
                    (CreatedAtRouteNegotiatedContentResult<DoctorModel>)result;
                createdDoctorID = doctorContentResult.Content.DoctorID;
            }

            // Create a new test exam room, and get its exam room ID
            using (var examRoomController = new ExamRoomsController())
            {
                var examRoom = new ExamRoomModel
                {
                    ExamRoomName = "ImexamRoom"
                };
                IHttpActionResult result = examRoomController.PostExamRoom(examRoom);
                CreatedAtRouteNegotiatedContentResult<ExamRoomModel> examRoomContentResult =
                    (CreatedAtRouteNegotiatedContentResult<ExamRoomModel>)result;
                createdExamRoomID = examRoomContentResult.Content.ExamRoomID;
            }

            //Arrange:
            using (var apptController = new AppointmentsController())
            {
                var newAppt = new AppointmentModel
                {
                    DoctorID = createdDoctorID,
                    CheckinDateTime = DateTime.Now,
                    CheckoutDateTime = DateTime.Now.AddHours(2),
                    ExamRoomID = createdExamRoomID,
                    PatientID = createdPatientID
                };

                //Act
                IHttpActionResult result = apptController.PostAppointment(newAppt);

                //Assert
                Assert.IsInstanceOfType(result, typeof(CreatedAtRouteNegotiatedContentResult<AppointmentModel>));

                contentResult = (CreatedAtRouteNegotiatedContentResult<AppointmentModel>)result;

                Assert.IsTrue(contentResult.Content.AppointmentID != 0);
                appointmentIDForTest = contentResult.Content.AppointmentID;
            }

            //Delete the Appointment
            using (var SecondapptController = new AppointmentsController())
            {
              IHttpActionResult result = SecondapptController.DeleteAppointment(appointmentIDForTest);
            }

            // Remove the test doctor and patient from the database with actual deletion, not archiving
            using (MedAgendaDbContext db = new MedAgendaDbContext())
            {
                Doctor dbDoctor = db.Doctors.Find(createdDoctorID);
                db.Doctors.Remove(dbDoctor);
                Patient dbPatient = db.Patients.Find(createdPatientID);
                db.Patients.Remove(dbPatient);
                db.SaveChanges();
            }

            // Delete the test exam room
            using (var SecondExamRoomController = new ExamRoomsController())
            {
                IHttpActionResult result = SecondExamRoomController.DeleteExamRoom(createdExamRoomID);
            }

            // Delete the test specialty
            using (var specialtyController = new SpecialtiesController())
            {
                IHttpActionResult result = specialtyController.DeleteSpecialty(createdSpecialtyID);
            }
        }
コード例 #13
0
        public void PutDoctorCheckUpdateDoctorCheck()
        {
            int createdDoctorID;
            int createdExamRoomID;
            int changedExamRoomID;
            int createdSpecialtyID;
            int doctorCheckIDForTest;

            IHttpActionResult result;
            CreatedAtRouteNegotiatedContentResult<DoctorCheckModel> createdContentResult;
            OkNegotiatedContentResult<DoctorCheckModel> OkContentResult;
            DoctorCheckModel updatedDoctorCheck;

            //Arrange: create test specialty, doctor, and exam rooms
            // Create a new test specialty, and get its specialty ID
            using (var specialtyController = new SpecialtiesController())
            {
                var specialty = new SpecialtyModel
                {
                    SpecialtyName = "Very Special Doctor"
                };
                result = specialtyController.PostSpecialty(specialty);
                CreatedAtRouteNegotiatedContentResult<SpecialtyModel> specialtyContentResult =
                    (CreatedAtRouteNegotiatedContentResult<SpecialtyModel>)result;
                createdSpecialtyID = specialtyContentResult.Content.SpecialtyID;
            }

            // Create a new test doctor, and get its doctor ID
            using (var doctorController = new DoctorsController())
            {
                var doctor = new DoctorModel
                {
                    FirstName = "Imdoctor",
                    LastName = "Hippocrates",
                    Email = "*****@*****.**",
                    Telephone = "555-1212",
                    CreatedDate = DateTime.Now,
                    SpecialtyID = createdSpecialtyID,
                    Archived = false
                };
                result = doctorController.PostDoctor(doctor);
                CreatedAtRouteNegotiatedContentResult<DoctorModel> doctorContentResult =
                    (CreatedAtRouteNegotiatedContentResult<DoctorModel>)result;
                createdDoctorID = doctorContentResult.Content.DoctorID;
            }

            // Create new test exam rooms, and save exam room IDs
            using (var examRoomController = new ExamRoomsController())
            {
                var examRoom = new ExamRoomModel
                {
                    ExamRoomName = "ImexamRoom"
                };
                result = examRoomController.PostExamRoom(examRoom);
                CreatedAtRouteNegotiatedContentResult<ExamRoomModel> examRoomContentResult =
                    (CreatedAtRouteNegotiatedContentResult<ExamRoomModel>)result;
                createdExamRoomID = examRoomContentResult.Content.ExamRoomID;
            }
            using (var examRoomController = new ExamRoomsController())
            {
                var examRoom = new ExamRoomModel
                {
                    ExamRoomName = "AnotherexamRoom"
                };
                result = examRoomController.PostExamRoom(examRoom);
                CreatedAtRouteNegotiatedContentResult<ExamRoomModel> examRoomContentResult =
                    (CreatedAtRouteNegotiatedContentResult<ExamRoomModel>)result;
                changedExamRoomID = examRoomContentResult.Content.ExamRoomID;
            }

            //Arrange: Add new doctorCheck, and save its doctorCheckID
            using (var doctorsCheckController = new DoctorsCheckController())
            {
                var newDoctorCheck = new DoctorCheckModel
                {
                    DoctorID = createdDoctorID,
                    ExamRoomID = createdExamRoomID,
                    CheckinDateTime = DateTime.Now,
                    CheckoutDateTime = DateTime.Now.AddHours(2),
                };
                result = doctorsCheckController.PostDoctorCheck(newDoctorCheck);
                createdContentResult =
                    (CreatedAtRouteNegotiatedContentResult<DoctorCheckModel>)result;
                doctorCheckIDForTest = createdContentResult.Content.DoctorCheckID;
            }

            // Get the doctorCheck from the DB
            using (var doctorsCheckController = new DoctorsCheckController())
            {
                result = doctorsCheckController.GetDoctorCheck(doctorCheckIDForTest);
                OkContentResult =
                    (OkNegotiatedContentResult<DoctorCheckModel>)result;
                updatedDoctorCheck = (DoctorCheckModel)createdContentResult.Content;
            }

            using (var doctorsCheckController = new DoctorsCheckController())
            {
                updatedDoctorCheck.ExamRoomID = changedExamRoomID;

                result = doctorsCheckController.PutDoctorCheck
                                         (updatedDoctorCheck.DoctorCheckID, updatedDoctorCheck);
            }

            // Verify that HTTP status code is OK
            // Get the doctor check and verify that it was updated

            var statusCode = (StatusCodeResult)result;
            Assert.IsTrue(statusCode.StatusCode == System.Net.HttpStatusCode.NoContent);

            using (var doctorsCheckController = new DoctorsCheckController())
            {
                result = doctorsCheckController.GetDoctorCheck(doctorCheckIDForTest);

                Assert.IsInstanceOfType(result,
                    typeof(OkNegotiatedContentResult<DoctorCheckModel>));

                OkContentResult =
                    (OkNegotiatedContentResult<DoctorCheckModel>)result;
                updatedDoctorCheck = (DoctorCheckModel)OkContentResult.Content;
            }

            Assert.IsTrue(updatedDoctorCheck.ExamRoomID == changedExamRoomID);

            // Delete the test doctorCheck
            using (var doctorsCheckController = new DoctorsCheckController())
            {
                result = doctorsCheckController.DeleteDoctorCheck(doctorCheckIDForTest);
            }

            // Remove the test doctor from the database with actual deletion, not archiving
            using (MedAgendaDbContext db = new MedAgendaDbContext())
            {
                Doctor dbDoctor = db.Doctors.Find(createdDoctorID);
                db.Doctors.Remove(dbDoctor);
                db.SaveChanges();
            }

            // Delete the test exam rooms
            using (var SecondExamRoomController = new ExamRoomsController())
            {
                result = SecondExamRoomController.DeleteExamRoom(createdExamRoomID);
            }
            using (var SecondExamRoomController = new ExamRoomsController())
            {
                result = SecondExamRoomController.DeleteExamRoom(changedExamRoomID);
            }

            // Delete the test specialty
            using (var specialtyController = new SpecialtiesController())
            {
                result = specialtyController.DeleteSpecialty(createdSpecialtyID);
            }
        }
コード例 #14
0
        public void DeletePatientCheck()
        {
            int createdPatientID;
            int createdSpecialtyID;
            IHttpActionResult result;
            CreatedAtRouteNegotiatedContentResult<PatientCheckModel> contentResult;

            // Create a new test patient, and get its patient ID
            using (var patientController = new PatientsController())
            {
                var patient = new PatientModel
                {
                    FirstName = "Testpatient",
                    LastName = "Testerson",
                    Birthdate = new DateTime(1968, 12, 27),
                    Email = "*****@*****.**",
                    BloodType = "A+",
                    CreatedDate = new DateTime(2015, 11, 10),
                    Archived = false
                };
                result = patientController.PostPatient(patient);
                CreatedAtRouteNegotiatedContentResult<PatientModel> createdContentResult =
                    (CreatedAtRouteNegotiatedContentResult<PatientModel>)result;
                createdPatientID = createdContentResult.Content.PatientID;
            }

            // Create a new test specialty, and get its specialty ID
            using (var specialtyController = new SpecialtiesController())
            {
                var specialty = new SpecialtyModel
                {
                    SpecialtyName = "Very Special Doctor"
                };
                result = specialtyController.PostSpecialty(specialty);
                CreatedAtRouteNegotiatedContentResult<SpecialtyModel> specialtyContentResult =
                    (CreatedAtRouteNegotiatedContentResult<SpecialtyModel>)result;
                createdSpecialtyID = specialtyContentResult.Content.SpecialtyID;
            }

            using (var patientCheckController = new PatientChecksController())
            {
                var newPatientCheck = new PatientCheckModel
                {
                    PatientID = createdPatientID,
                    SpecialtyID = createdSpecialtyID,
                    CheckinDateTime = DateTime.Now,
                    CheckoutDateTime = DateTime.Now.AddHours(2)
                };
                result = patientCheckController.PostPatientCheck(newPatientCheck);

                contentResult = (CreatedAtRouteNegotiatedContentResult<PatientCheckModel>)result;
            }
            using (var SecondPatientCheckController = new PatientChecksController())
            {
                result = SecondPatientCheckController.DeletePatientCheck(contentResult.Content.PatientCheckID);

                Assert.IsInstanceOfType(result, typeof(OkNegotiatedContentResult<PatientCheckModel>));
            }
            using (var ThirdPatientCheckController = new PatientChecksController())
            {
                result = ThirdPatientCheckController.GetPatientCheck(contentResult.Content.PatientCheckID);

                Assert.IsInstanceOfType(result, typeof(NotFoundResult));

            }

            // Delete the test patient (actual deletion, not archiving)
            using (MedAgendaDbContext db = new MedAgendaDbContext())
            {
                Patient dbPatient = db.Patients.Find(createdPatientID);
                db.Patients.Remove(dbPatient);
                db.SaveChanges();
            }

            // Delete the test specialty
            using (var specialtyController = new SpecialtiesController())
            {
                result = specialtyController.DeleteSpecialty(createdSpecialtyID);
            }
        }
コード例 #15
0
        public void PutSpecialtyUpdateSpecialty()
        {
            //Test Specialty
            IHttpActionResult result;
            CreatedAtRouteNegotiatedContentResult<SpecialtyModel> contentResult;
            OkNegotiatedContentResult<SpecialtyModel> specialtyResult;
            OkNegotiatedContentResult<SpecialtyModel> readContentResult;

            using (var SpecialtyController = new SpecialtiesController())
            {
                //Create Specialty
                var newSpecialty = new SpecialtyModel
                {
                    SpecialtyName = "Testologist",

                };
                //Insert SpecialtyModelObject into Database so
                //that I can take it out and test for update.
                result = SpecialtyController.PostSpecialty(newSpecialty);

                //Cast result as Content Result so that I can gather information from ContentResult
                contentResult = (CreatedAtRouteNegotiatedContentResult<SpecialtyModel>)result;
            }
            using (var SecondSpecialtyController = new SpecialtiesController())
            {
                //Result contains the Specialty I had JUST createad
                result = SecondSpecialtyController.GetSpecialty(contentResult.Content.SpecialtyID);

                Assert.IsInstanceOfType(result, typeof(OkNegotiatedContentResult<SpecialtyModel>));

                //Get SpecialtyModel from 'result'
                specialtyResult = (OkNegotiatedContentResult<SpecialtyModel>)result;

            }

            using (var ThirdSpecialtyController = new SpecialtiesController())
            {
                var modifiedSpecialty = specialtyResult.Content;

                modifiedSpecialty.SpecialtyName = "Updated Testologist";

                //Act
                //The result of the Put Request
                result = ThirdSpecialtyController.PutSpecialty(specialtyResult.Content.SpecialtyID, modifiedSpecialty);

                //Assert
                Assert.IsInstanceOfType(result, typeof(StatusCodeResult));
            }
            using (var FourthSpecialtyController = new SpecialtiesController())
            {
                //Act
                IHttpActionResult resultAlteredSpecialty = FourthSpecialtyController.GetSpecialty(specialtyResult.Content.SpecialtyID);

                OkNegotiatedContentResult<SpecialtyModel> alteredResult = (OkNegotiatedContentResult<SpecialtyModel>)resultAlteredSpecialty;
                SpecialtyModel updatedSpecialty = (SpecialtyModel)alteredResult.Content;

                //Assert
                Assert.IsInstanceOfType(resultAlteredSpecialty, typeof(OkNegotiatedContentResult<SpecialtyModel>));

                readContentResult =
                    (OkNegotiatedContentResult<SpecialtyModel>)resultAlteredSpecialty;

                Assert.IsTrue(readContentResult.Content.SpecialtyName == "Updated Testologist");
            }
            using (var FifthSpecialtyController = new SpecialtiesController())
            {
                //Delete the Test Specialty
                result = FifthSpecialtyController.DeleteSpecialty(readContentResult.Content.SpecialtyID);
            }
        }
コード例 #16
0
        public void PutPatientCheckReturnPatientCheck()
        {
            IHttpActionResult result;
            CreatedAtRouteNegotiatedContentResult<PatientCheckModel> contentResult;
            OkNegotiatedContentResult<PatientCheckModel> patientCheckResult;
            OkNegotiatedContentResult<PatientCheckModel> readContentResult;
            DateTime now = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day,
                                        DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second);
            int createdPatientID;
            int createdSpecialtyID;

            // Create a new test patient, and get its patient ID
            using (var patientController = new PatientsController())
            {
                var patient = new PatientModel
                {
                    FirstName = "Testpatient",
                    LastName = "Testerson",
                    Birthdate = new DateTime(1968, 12, 27),
                    Email = "*****@*****.**",
                    BloodType = "A+",
                    CreatedDate = new DateTime(2015, 11, 10),
                    Archived = false
                };
                result = patientController.PostPatient(patient);
                CreatedAtRouteNegotiatedContentResult<PatientModel> createdContentResult =
                    (CreatedAtRouteNegotiatedContentResult<PatientModel>)result;
                createdPatientID = createdContentResult.Content.PatientID;
            }

            // Create a new test specialty, and get its specialty ID
            using (var specialtyController = new SpecialtiesController())
            {
                var specialty = new SpecialtyModel
                {
                    SpecialtyName = "Very Special Doctor"
                };
                result = specialtyController.PostSpecialty(specialty);
                CreatedAtRouteNegotiatedContentResult<SpecialtyModel> specialtyContentResult =
                    (CreatedAtRouteNegotiatedContentResult<SpecialtyModel>)result;
                createdSpecialtyID = specialtyContentResult.Content.SpecialtyID;
            }

            using (var patientCheckController = new PatientChecksController())
            {
                var newPatientCheck = new PatientCheckModel
                {
                    PatientID = createdPatientID,
                    SpecialtyID = createdSpecialtyID,
                    CheckinDateTime = now,
                    CheckoutDateTime = now.AddHours(2)
                };

                result = patientCheckController.PostPatientCheck(newPatientCheck);

                contentResult = (CreatedAtRouteNegotiatedContentResult<PatientCheckModel>)result;

            }
            using (var SecondPatientCheckController = new PatientChecksController())
            {
                result = SecondPatientCheckController.GetPatientCheck(contentResult.Content.PatientCheckID);

                Assert.IsInstanceOfType(result, typeof(OkNegotiatedContentResult<PatientCheckModel>));

                patientCheckResult = (OkNegotiatedContentResult<PatientCheckModel>)result;
            }
            using (var ThirdPatientCheckController = new PatientChecksController())
            {
                var modifiedPatientCheck = patientCheckResult.Content;

                modifiedPatientCheck.CheckoutDateTime = now;

                result = ThirdPatientCheckController.PutPatientCheck(patientCheckResult.Content.PatientCheckID, modifiedPatientCheck);

                Assert.IsInstanceOfType(result, typeof(StatusCodeResult));
            }

            using (var FourthPatientCheckController = new PatientChecksController())
            {
                IHttpActionResult resultAlteredPatientCheck = FourthPatientCheckController.GetPatientCheck(patientCheckResult.Content.PatientCheckID);

                OkNegotiatedContentResult<PatientCheckModel> alteredResult = (OkNegotiatedContentResult<PatientCheckModel>)resultAlteredPatientCheck;

                PatientCheckModel updatedPatientCheck = (PatientCheckModel)alteredResult.Content;

                Assert.IsInstanceOfType(resultAlteredPatientCheck, typeof(OkNegotiatedContentResult<PatientCheckModel>));

                readContentResult = (OkNegotiatedContentResult<PatientCheckModel>)resultAlteredPatientCheck;

                Assert.IsTrue(readContentResult.Content.CheckoutDateTime == now);
            }

            // Delete the test patient check
            using (var FifthPatientCheckController = new PatientChecksController())
            {
                result = FifthPatientCheckController.DeletePatientCheck(readContentResult.Content.PatientCheckID);
            }

            // Delete the test patient (actual deletion, not archiving)
            using (MedAgendaDbContext db = new MedAgendaDbContext())
            {
                Patient dbPatient = db.Patients.Find(createdPatientID);
                db.Patients.Remove(dbPatient);
                db.SaveChanges();
            }

            // Delete the test specialty
            using (var specialtyController = new SpecialtiesController())
            {
                result = specialtyController.DeleteSpecialty(createdSpecialtyID);
            }
        }
コード例 #17
0
        public void DeleteDoctorsCheck()
        {
            int createdDoctorID;
            int createdExamRoomID;
            int createdSpecialtyID;
            int doctorsCheckIDForTest;

            IHttpActionResult result;
            CreatedAtRouteNegotiatedContentResult<DoctorCheckModel> createdContentResult;

            //Arrange: create test specialty, doctor, exam room, and doctor check-in
            // Create a new test specialty, and get its specialty ID
            using (var specialtyController = new SpecialtiesController())
            {
                var specialty = new SpecialtyModel
                {
                    SpecialtyName = "Very Special Doctor"
                };
                result = specialtyController.PostSpecialty(specialty);
                CreatedAtRouteNegotiatedContentResult<SpecialtyModel> specialtyContentResult =
                    (CreatedAtRouteNegotiatedContentResult<SpecialtyModel>)result;
                createdSpecialtyID = specialtyContentResult.Content.SpecialtyID;
            }

            // Create a new test doctor, and get its doctor ID
            using (var doctorController = new DoctorsController())
            {
                var doctor = new DoctorModel
                {
                    FirstName = "Imdoctor",
                    LastName = "Hippocrates",
                    Email = "*****@*****.**",
                    Telephone = "555-1212",
                    CreatedDate = DateTime.Now,
                    SpecialtyID = createdSpecialtyID,
                    Archived = false
                };
                result = doctorController.PostDoctor(doctor);
                CreatedAtRouteNegotiatedContentResult<DoctorModel> doctorContentResult =
                    (CreatedAtRouteNegotiatedContentResult<DoctorModel>)result;
                createdDoctorID = doctorContentResult.Content.DoctorID;
            }

            // Create a new test exam room, and get its exam room ID
            using (var examRoomController = new ExamRoomsController())
            {
                var examRoom = new ExamRoomModel
                {
                    ExamRoomName = "ImexamRoom"
                };
                result = examRoomController.PostExamRoom(examRoom);
                CreatedAtRouteNegotiatedContentResult<ExamRoomModel> examRoomContentResult =
                    (CreatedAtRouteNegotiatedContentResult<ExamRoomModel>)result;
                createdExamRoomID = examRoomContentResult.Content.ExamRoomID;
            }

            // Create a new test doctorCheck, and get its doctorCheckID
            using (var doctorsCheckController = new DoctorsCheckController())
            {
                var doctorsCheck = new DoctorCheckModel
                {
                    DoctorID = createdDoctorID,
                    ExamRoomID = createdExamRoomID,
                    CheckinDateTime = DateTime.Now,
                    CheckoutDateTime = DateTime.Now.AddHours(2)
                };
                result = doctorsCheckController.PostDoctorCheck(doctorsCheck);
                createdContentResult =
                    (CreatedAtRouteNegotiatedContentResult<DoctorCheckModel>)result;
                doctorsCheckIDForTest = createdContentResult.Content.DoctorCheckID;
            }

            //Delete the doctorCheck
            using (var doctorsCheckController = new DoctorsCheckController())
            {
                result = doctorsCheckController.DeleteDoctorCheck(doctorsCheckIDForTest);

                // Verify that HTTP result is OK
                Assert.IsInstanceOfType(result, typeof(OkNegotiatedContentResult<DoctorCheckModel>));
            }

            // Verify that reading deleted doctor check returns result not found
            using (var doctorsCheckController = new DoctorsCheckController())
            {
                result = doctorsCheckController.GetDoctorCheck(doctorsCheckIDForTest);
                Assert.IsInstanceOfType(result, typeof(NotFoundResult));
            }

            // Remove the test doctor from the database with actual deletion, not archiving
            using (MedAgendaDbContext db = new MedAgendaDbContext())
            {
                Doctor dbDoctor = db.Doctors.Find(createdDoctorID);
                db.Doctors.Remove(dbDoctor);
                db.SaveChanges();
            }

            // Delete the test exam room
            using (var SecondExamRoomController = new ExamRoomsController())
            {
                result = SecondExamRoomController.DeleteExamRoom(createdExamRoomID);
            }

            // Delete the test specialty
            using (var specialtyController = new SpecialtiesController())
            {
                result = specialtyController.DeleteSpecialty(createdSpecialtyID);
            }
        }