Beispiel #1
0
        public void TwoPatientsRegistration()
        {
            _hospitalResources.Doctors = new List <DoctorResource>()
            {
                new DoctorResource("DoctorWho", new List <string>()
                {
                    "Oncologist", "Cosmologist"
                })
            };
            _hospitalResources.TreatmentRooms = new List <TreatmentRoomResource>()
            {
                new TreatmentRoomResource()
                {
                    Name = "Room1", TreatmentMachine = "Machine1", FullyBookedDays = new List <DateTime>()
                    {
                        DateTime.Now.Date, DateTime.Now.Date.AddDays(1)
                    }
                }
            };
            _hospitalResources.TreatmentMachines = new List <TreatmentMachineResource>()
            {
                new TreatmentMachineResource("Machine1", "Simple")
            };

            var logic = new LogicApplication(_hospitalResources);

            _mockedPatient.Setup(p => p.GetPatientsRegistered()).Returns(new List <PatientRegistrationModel>()
            {
                new PatientRegistrationModel()
                {
                    Name = "Stelios", Condition = "cancer", Topography = "breast"
                }, new PatientRegistrationModel()
                {
                    Name = "Erika", Condition = "cancer", Topography = "breast"
                }
            });

            var runAHospital = new RunAHospital(_mockedHospitalData.Object, logic, _mockedPatient.Object);
            var sut          = runAHospital.BookAppointments();

            Assert.NotEmpty(sut);
            Assert.Equal("DoctorWho", sut[0].DoctorName);
            Assert.Equal("Room1", sut[0].RoomName);
            Assert.Equal(DateTime.Now.Date.AddDays(2), sut[0].Date);
        }
        public void GetConsultationTests(string patientName,
                                         string expectedDoctorSpecialization, string expectedRoom, bool willGetAnAppointment)
        {
            _hospitalResources.Doctors = new List <DoctorResource>()
            {
                new DoctorResource("DoctorWho", new List <string>()
                {
                    "Oncologist", "Cosmologist"
                })
            };
            _hospitalResources.TreatmentRooms = new List <TreatmentRoomResource>()
            {
                new TreatmentRoomResource()
                {
                    Name = "Room1", TreatmentMachine = "Machine1", FullyBookedDays = new List <DateTime>()
                }
            };
            _hospitalResources.TreatmentMachines = new List <TreatmentMachineResource>()
            {
                new TreatmentMachineResource("Machine1", "Simple")
            };

            var logicApplication = new LogicApplication(_hospitalResources);
            var test             = new List <PatientAndRequirements>()
            {
                new PatientAndRequirements()
                {
                    DoctorsSpecialization = expectedDoctorSpecialization, Name = patientName,
                    UniqueId = Guid.NewGuid(), TreatmentRoom = new List <string>()
                    {
                        expectedRoom
                    }
                }
            };

            var sut = logicApplication.GetConsultation(test);

            Assert.Equal(sut.Any(), willGetAnAppointment);
        }
        public void IdentifyResourcesTests(string patientName, string condition, string topology,
                                           string expectedDoctorSpecialization, string expectedRoom)
        {
            _hospitalResources.Doctors = new List <DoctorResource>()
            {
                new DoctorResource("DoctorWho", new List <string>()
                {
                    "Oncologist", "Cosmologist"
                })
            };
            _hospitalResources.TreatmentRooms = new List <TreatmentRoomResource>()
            {
                new TreatmentRoomResource()
                {
                    Name = "Room1", TreatmentMachine = "Machine1", FullyBookedDays = new List <DateTime>()
                }
            };
            _hospitalResources.TreatmentMachines = new List <TreatmentMachineResource>()
            {
                new TreatmentMachineResource("Machine1", "Simple")
            };

            var logicApplication = new LogicApplication(_hospitalResources);

            _mockedPatient.Setup(p => p.GetPatientsRegistered())
            .Returns(new List <PatientRegistrationModel>()
            {
                new PatientRegistrationModel()
                {
                    Name = patientName, Condition = condition, Topography = topology
                }
            });
            var patients = _mockedPatient.Object.GetPatientsRegistered();

            var sut = patients.Select(x => logicApplication.IdentifyResources(x)).ToList();

            Assert.Equal(expectedDoctorSpecialization, sut[0].DoctorsSpecialization);
            Assert.Equal(expectedRoom, sut[0].TreatmentRoom.FirstOrDefault());
        }