Пример #1
0
        public void ConsultationsController_GetConsultations_ConsultationsRetrievalOk()
        {
            List <Patient> newPatients = CreatTestPatients();

            var controller = new PatientController
            {
                Request       = new HttpRequestMessage(),
                Configuration = new HttpConfiguration()
            };

            foreach (var patient in newPatients)
            {
                var response = controller.RegisterPatient(patient);
                Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
            }

            var consulationController = new ConsultationsController
            {
                Request       = new HttpRequestMessage(),
                Configuration = new HttpConfiguration()
            };

            var result = consulationController.GetConsultations();

            Assert.AreEqual(result.StatusCode, HttpStatusCode.OK);

            //Clear registered patients so that individual unit test has control over patient and consultation data.
            PatientSchedulerContext.Patients.Clear();
            PatientSchedulerContext.Consultations.Clear();
        }