private Models.PatientAdmission.PatientAdmission CreatePatientAdmission()
        {
            Models.PatientAdmission.PatientAdmission patientAdmission = new Models.PatientAdmission.PatientAdmission
            {
                PatientId     = "P100",
                DoctorId      = "DR100",
                Illness       = "cold",
                Diagnosis     = "u r ok",
                AdmissionTime = DateTime.Now.ToString(),
                MuteAlert     = false,
                Bed           = new Models.HospitalBed.HospitalBed
                {
                    Campus     = "PIc",
                    Floor      = "Ground",
                    Wing       = "A",
                    RoomNumber = "1",
                    BedNumber  = 5,
                    Occupancy  = "P100",
                }
            };

            Device device = CreateDevice();

            patientAdmission.Devices = new List <Device>();
            patientAdmission.Devices.Add(device);
            device          = new Models.Device.Device();
            device.Limits   = new System.Collections.Generic.List <Models.Device.Limits>();
            device.DeviceId = "D102";
            patientAdmission.Devices.Add(device);

            return(patientAdmission);
        }
 public void Given_InvalidDevicetId_Arguments_When_AddDevice_Invoked_Then_false_Asserted()
 {
     AdmitPatient();
     Models.Device.Device device = CreateDevice();
     device.DeviceId = "DInvalid";
     Assert.IsFalse(_admissionRepo.AddDevice("P100", device));
     DischargePatient();
 }
 public void Given_Valid_Arguments_When_AddDevice_Invoked_Then_true_Asserted()
 {
     AdmitPatient();
     Models.Device.Device device = CreateDevice();
     device.DeviceId = "D103";
     Assert.IsTrue(_admissionRepo.AddDevice("P100", device));
     DischargePatient();
 }
 private void AddDevicesToDB()
 {
     Models.Device.Device device = CreateDevice();
     deviceRepo.RegisterNew(device);
     device.DeviceId = "D102";
     deviceRepo.RegisterNew(device);
     device.DeviceId = "D103";
     deviceRepo.RegisterNew(device);
 }
 public void Given_Invalid_DeviceId_Arguments_When_Admit_Invoked_Then_false_Asserted()
 {
     Models.PatientAdmission.PatientAdmission admission = CreatePatientAdmission();
     Models.Device.Device device = new Models.Device.Device();
     device.DeviceId = "InvalidD101";
     device.Limits   = new System.Collections.Generic.List <Models.Device.Limits>();
     admission.Devices.Add(device);
     Assert.IsFalse(_admissionRepo.Admit(admission));
 }
        private Models.Device.Device CreateDevice()
        {
            Models.Device.Device device = new Models.Device.Device
            {
                DeviceId      = "D101",
                MaxInputValue = 100,
                MinInputValue = 0,
            };

            device.Limits = new System.Collections.Generic.List <Models.Device.Limits>();
            device.Limits.Add(new Models.Device.Limits {
                MinValue = 0, MaxValue = 100, Type = Models.Device.LimitType.Normal, Message = "normaa"
            });
            return(device);
        }
 public void Given_Existing_DevicetId_Arguments_When_AddDevice_Invoked_Then_false_Asserted()
 {
     Models.Device.Device device = CreateDevice();
     device.DeviceId = "D102";
     Assert.IsFalse(_admissionRepo.AddDevice("InvalidP100", device));
 }
예제 #8
0
        private static void DeviceRegistration()
        {
            string url = "http://localhost:51033/DeviceRegistrationService.svc/DeviceRegistrationService/";

            Device device = new Device
            {
                DeviceId      = "Temperature",
                Limits        = new List <Limits>(),
                MaxInputValue = 100,
                MinInputValue = 0
            };

            device.Limits.Add(new Limits
            {
                MaxValue = 35,
                MinValue = 0,
                Message  = "WarningMessage",
                Type     = LimitType.Warning
            });
            device.Limits.Add(new Limits
            {
                MaxValue = 70,
                MinValue = 35,
                Message  = "NormalMessage",
                Type     = LimitType.Normal
            });
            device.Limits.Add(new Limits
            {
                MaxValue = 100,
                MinValue = 70,
                Message  = "CriticalMessage",
                Type     = LimitType.Critical
            });
            string json = JsonConvert.SerializeObject(device);

            json = "{\"device\":" + json + "}";
            client.Headers[HttpRequestHeader.ContentType] = "application/json";
            var response = client.UploadString(url + "RegisterDevice", "PUT", json);

            device.DeviceId = "HeartRate";
            device.Limits.Add(new Limits
            {
                MaxValue = 80,
                MinValue = 0,
                Message  = "WarningMessage",
                Type     = LimitType.Warning
            });
            device.Limits.Add(new Limits
            {
                MaxValue = 90,
                MinValue = 80,
                Message  = "NormalMessage",
                Type     = LimitType.Normal
            });
            device.Limits.Add(new Limits
            {
                MaxValue = 100,
                MinValue = 90,
                Message  = "CriticalMessage",
                Type     = LimitType.Critical
            });
            json = JsonConvert.SerializeObject(device);
            json = "{\"device\":" + json + "}";
            client.Headers[HttpRequestHeader.ContentType] = "application/json";
            response        = client.UploadString(url + "RegisterDevice", "PUT", json);
            device.DeviceId = "SPO2";
            device.Limits.Add(new Limits
            {
                MaxValue = 20,
                MinValue = 0,
                Message  = "WarningMessage",
                Type     = LimitType.Warning
            });
            device.Limits.Add(new Limits
            {
                MaxValue = 40,
                MinValue = 20,
                Message  = "NormalMessage",
                Type     = LimitType.Normal
            });
            device.Limits.Add(new Limits
            {
                MaxValue = 100,
                MinValue = 40,
                Message  = "CriticalMessage",
                Type     = LimitType.Critical
            });
            json = JsonConvert.SerializeObject(device);
            json = "{\"device\":" + json + "}";
            client.Headers[HttpRequestHeader.ContentType] = "application/json";
            response = client.UploadString(url + "RegisterDevice", "PUT", json);
        }