static int Main() { IStatusLogger logger = new ConsoleLogger(); VitalValueTester valueTester = new VitalValueTester(logger); VitalsChecker checker = new VitalsChecker(logger); IReporter reporter = new VitalsChecker(logger); // All within limits ExpectTrue(reporter.CheckVitals(100, 95, 60)); //Two withhin limits ExpectFalse(reporter.CheckVitals(40, 91, 92)); ExpectFalse(reporter.CheckVitals(150, 89, 72)); ExpectFalse(reporter.CheckVitals(70, 95, 25)); //Only one within limits ExpectFalse(reporter.CheckVitals(162, 70, 92)); ExpectFalse(reporter.CheckVitals(63, 99, 97)); ExpectFalse(reporter.CheckVitals(90, 73, 27)); //All vitals out of limits ExpectFalse(reporter.CheckVitals(170, 60, 100)); return(0); }
public bool CheckVitals(float bpm, float spo2, float respRate) { testCount++; Console.WriteLine("Test case : {0}", testCount); VitalValueTester valueTester = new VitalValueTester(this.allOkLogger); bool vital1 = valueTester.CheckValueAgainstRange("BPM", bpm, 70, 150); bool vital2 = valueTester.CheckValueAgainstRange("SpO2", spo2, 90, null); bool vital3 = valueTester.CheckValueAgainstRange("Respiration rate", respRate, 30, 95); bool vitalCheck = vital1 && vital2 && vital3; this.LogVitalsOk(vitalCheck); Console.WriteLine("\n"); //To seperate output streams return(vitalCheck); }