static void Main() { AlertInSMS alertsms = new AlertInSMS(); AlertInSound alertsound = new AlertInSound(); vitals bpm = new vitals("Bpm", 150, 70); bpm.CheckVitals(alertsms, "Bpm", 40); bpm.CheckVitals(alertsound, "Bpm", 170); bpm.CheckVitals(alertsound, "Bpm", 150); ExpectTrue(bpm.checkHigh("Bpm", 190)); ExpectTrue(bpm.checkLow("Bpm", 19)); ExpectTrue(bpm.checkNormal("Bpm", 70)); ExpectFalse(bpm.checkHigh("Bpm", 17)); ExpectFalse(bpm.checkLow("Bpm", 120)); ExpectFalse(bpm.checkNormal("Bpm", 12)); vitals resp = new vitals("Resp", 95, 30); resp.CheckVitals(alertsms, "Resp", 14); resp.CheckVitals(alertsound, "Resp", 170); resp.CheckVitals(alertsound, "Resp", 30); ExpectTrue(resp.checkHigh("Resp", 96)); ExpectTrue(resp.checkLow("Resp", 29)); ExpectTrue(resp.checkNormal("Resp", 30)); ExpectFalse(resp.checkHigh("Resp", 17)); ExpectFalse(resp.checkLow("Resp", 30)); ExpectFalse(resp.checkNormal("Resp", 120)); vitals spo2 = new vitals("Spo2", 90, 90); spo2.CheckVitals(alertsms, "Spo2", 14); spo2.CheckVitals(alertsound, "Spo2", 120); spo2.CheckVitals(alertsound, "Spo2", 90); ExpectTrue(spo2.checkHigh("Spo2", 109)); ExpectTrue(spo2.checkLow("Spo2", 45)); ExpectTrue(spo2.checkNormal("Spo2", 90)); ExpectFalse(spo2.checkHigh("Spo2", 17)); ExpectFalse(spo2.checkLow("Spo2", 90)); ExpectFalse(spo2.checkNormal("Spo2", 120)); }
static int Main() { AlertInSMS smsAlert = new AlertInSMS(); Alert _smsAlertCommand = new Alert(smsAlert.SendAlert); Thread _t1 = new Thread(_smsAlertCommand); vitalsAreOk(_t1, new float[] { 100, 95, 60 }); vitalsAreOk(_t1, new float[] { 40, 91, 92 }); AlertInSound soundAlert = new AlertInSound(); Alert _soundAlertCommand = new Alert(soundAlert.SendAlert); Thread _t2 = new Thread(_soundAlertCommand); vitalIsOk(_t2, 110, vitals[(int)VitalList.BPM]); vitalIsOk(_t2, 80, vitals[(int)VitalList.SPO2]); vitalIsOk(_t2, 100, vitals[(int)VitalList.RESPRATE]); Console.WriteLine("All ok"); return(0); }