コード例 #1
0
        public void TestForGettingAvailableBedsFromAllExistingIcus()
        {
            var occupancyServices = new OccupancyServices(Context);
            var freeBeds          = occupancyServices.AvailableBeds();

            Assert.Equal(4, freeBeds.LongCount());
        }
コード例 #2
0
        public void TestForAddingExistingPatient()
        {
            var occupancyServices = new OccupancyServices(Context);
            var patientVitals     = new List <VitalsModel>()
            {
                new VitalsModel()
                {
                    Name = "Resp", Value = 80, LowerLimit = 70, UpperLimit = 150
                },
                new VitalsModel()
                {
                    Name = "Bp", Value = 80, LowerLimit = 80, UpperLimit = 150
                },
                new VitalsModel()
                {
                    Name = "Spo2", Value = 80, LowerLimit = 90, UpperLimit = 100
                },
            };
            var patient = new PatientModel()
            {
                PatientId = "P001",
                Name      = "Mahesh",
                Age       = 25,
                Address   = "Hyderabad",
                IcuId     = "ICU01",
                BedId     = "ICU01L001",
                Vitals    = patientVitals
            };
            var expected = "Patient Already Exists";
            var actual   = occupancyServices.AddPatient(patient);

            Assert.Equal(expected, actual);
        }
コード例 #3
0
        public void TestForAddingNonExistingPatientIntoExistingIcuWithEmptyBed()
        {
            var occupancyServices = new OccupancyServices(Context);
            var patientVitals     = new List <VitalsModel>()
            {
                new VitalsModel()
                {
                    Name = "Resp", Value = 80, LowerLimit = 70, UpperLimit = 150
                },
                new VitalsModel()
                {
                    Name = "Bp", Value = 80, LowerLimit = 80, UpperLimit = 150
                },
                new VitalsModel()
                {
                    Name = "Spo2", Value = 80, LowerLimit = 90, UpperLimit = 100
                },
            };
            var patient = new PatientModel()
            {
                PatientId = "P003",
                Name      = "Mahesh",
                Age       = 25,
                Address   = "Hyderabad",
                IcuId     = "ICU02",
                BedId     = "ICU02U001",
                Vitals    = patientVitals
            };
            var expected = "Patient Added Successfully";
            var actual   = occupancyServices.AddPatient(patient);

            Assert.Equal(expected, actual);
            ArePatientsSame(patient, occupancyServices.GetPatient("P003"));
            Assert.Equal("Occupied", occupancyServices.GetBed("ICU02", "ICU02U001").BedOccupancyStatus);
        }
コード例 #4
0
        public void TestForGettingAllpatients()
        {
            var occupancyServices = new OccupancyServices(Context);
            var patients          = occupancyServices.GetAllPatients();

            Assert.Equal(2, patients.LongCount());
        }
コード例 #5
0
        public void TestForGettingPatientGivenExistingPatientId()
        {
            var patient1Vitals = new List <VitalsModel>()
            {
                new VitalsModel()
                {
                    Name = "Resp", Value = 80, LowerLimit = 70, UpperLimit = 150
                },
                new VitalsModel()
                {
                    Name = "Bp", Value = 80, LowerLimit = 80, UpperLimit = 150
                },
                new VitalsModel()
                {
                    Name = "Spo2", Value = 80, LowerLimit = 90, UpperLimit = 100
                },
            };
            var patient1 = new PatientModel()
            {
                PatientId = "P001",
                Name      = "Suresh",
                Age       = 25,
                Address   = "Hyderabad",
                IcuId     = "ICU01",
                BedId     = "ICU01L001",
                Vitals    = patient1Vitals
            };

            var occupancyServices = new OccupancyServices(Context);
            var patient           = occupancyServices.GetPatient("P001");

            ArePatientsSame(patient, patient1);
        }
コード例 #6
0
        public void TestForAddingBedInExistingIcuWithNoAvailableSpace()
        {
            var    occupancyServices = new OccupancyServices(Context);
            string expected          = "Icu is Full";
            string actual            = occupancyServices.AddBed("ICU01");

            Assert.Equal(expected, actual);
        }
コード例 #7
0
        public void TestForRemovingNonExistingPatient()
        {
            var occupancyServices = new OccupancyServices(Context);
            var expected          = "No such patient";
            var actual            = occupancyServices.DischargePatient("P006");

            Assert.Equal(expected, actual);
        }
コード例 #8
0
        public void TestForAddingBedInNonExistingIcu()
        {
            var    occupancyServices = new OccupancyServices(Context);
            string expected          = "Icu not found";
            string actual            = occupancyServices.AddBed("ICU04");

            Assert.Equal(expected, actual);
        }
コード例 #9
0
        public void TestForRemovingExistingOccupiedBedInExistingIcu()
        {
            var    occupancyServices = new OccupancyServices(Context);
            string expected          = "Bed is occupied";
            string actual            = occupancyServices.RemoveBed("ICU01", "ICU01L001");

            Assert.Equal(expected, actual);
        }
コード例 #10
0
        public void TestForRemovingIcuWithNoPatients()
        {
            var    occupancyServices = new OccupancyServices(Context);
            string expected          = "Removed";
            string actual            = occupancyServices.RemoveIcu("ICU02");

            Assert.Equal(expected, actual);
        }
コード例 #11
0
        public void TestForRemovingNonExistingBedInExistingIcu()
        {
            var occupancyServices = new OccupancyServices(Context);
            var expected          = "Bed Doesn't Exist";
            var actual            = occupancyServices.RemoveBed("ICU01", "asdfg");

            Assert.Equal(expected, actual);
        }
コード例 #12
0
        public void TestForRemovingIcuWithPatients()
        {
            var    occupancyServices = new OccupancyServices(Context);
            string expected          = "Icu has patients, Cannot remove icu";
            string actual            = occupancyServices.RemoveIcu("ICU01");

            Assert.Equal(expected, actual);
        }
コード例 #13
0
        public void TestForRemovingExistingPatient()
        {
            var occupancyServices = new OccupancyServices(Context);
            var expected          = "Patient " + "P001" + " Discharged";
            var actual            = occupancyServices.DischargePatient("P001");

            Assert.Equal(expected, actual);
            Assert.Null(occupancyServices.GetPatient("P001"));
            Assert.Equal("Free", occupancyServices.GetBed("ICU01", "ICU01L001").BedOccupancyStatus);
        }
コード例 #14
0
        public void TestForAddingBedInNonFullExistingIcu()
        {
            var    occupancyServices = new OccupancyServices(Context);
            string expected          = "New Bed Added..! BedId: ICU02U004";
            string actual            = occupancyServices.AddBed("ICU02");
            var    bed = occupancyServices.GetBed("ICU02", "ICU02U004");

            Assert.Equal("Free", bed.BedOccupancyStatus);
            Assert.Equal("not specified", bed.Location);
            Assert.Equal(expected, actual);
        }
コード例 #15
0
        public void TestForGettingAllIcu()
        {
            var occupancyServices = new OccupancyServices(Context);
            var actualAllIcus     = occupancyServices.GetAllIcu();
            var originalAllIcus   = Context.Icu.ToList();

            foreach (var actualIcu in actualAllIcus)
            {
                var originalIcu = originalAllIcus.Find(icu => icu.IcuId == actualIcu.IcuId);
                Assert.NotNull(originalIcu);
            }
        }
コード例 #16
0
        public void TestForAdditionOfIcuWithMAxBedsEqualstoZero()
        {
            var    occupancyServices = new OccupancyServices(Context);
            string actual            = occupancyServices.AddIcu(new IcuModel()
            {
                IcuId    = "ICU05",
                Layout   = "L00",
                MaxBeds  = 0,
                NoOfBeds = 0
            });
            string expected = "ICU doesn't meet the conditions to be added";

            Assert.Equal(expected, actual);
        }
コード例 #17
0
        public void TestForAdditionOfExistingIcu()
        {
            var    occupancyServices = new OccupancyServices(Context);
            string actual            = occupancyServices.AddIcu(new IcuModel()
            {
                IcuId    = "ICU01",
                Layout   = "L00",
                MaxBeds  = 15,
                NoOfBeds = 0
            });
            string expected = "Icu with same id exists";

            Assert.Equal(expected, actual);
        }
コード例 #18
0
        public void TestForAdditionOfValidIcu()
        {
            var    occupancyServices = new OccupancyServices(Context);
            string actual            = occupancyServices.AddIcu(new IcuModel()
            {
                IcuId    = "ICU05",
                Layout   = "L00",
                MaxBeds  = 15,
                NoOfBeds = 0
            });
            string expected = "ICU Added";

            Assert.Equal(expected, actual);
        }