コード例 #1
0
        public object CreateAndReturnObj(PatientClassesEnumeration objectToGet)
        {
            object createdObject = null;

            switch (objectToGet)
            {
                case PatientClassesEnumeration.PatientAlarmer:
                    PatientAlarmer alarmer = new PatientAlarmer();
                    createdObject = alarmer;
                    break;
                case PatientClassesEnumeration.PatientDataReader:
                    PatientDataReader dataReader = new PatientDataReader();
                    createdObject = dataReader;
                    break;
                case PatientClassesEnumeration.PatientData:
                    PatientData patientData = new PatientData();
                    createdObject = patientData;
                    break;
                case PatientClassesEnumeration.PatientDataWriter:
                    PatientDataWriter dataWriter = new PatientDataWriter();
                    createdObject = dataWriter;
                    break;
                default:
                    throw new ArgumentException("Invalid parameter passed");
            }
            return createdObject;
        }
コード例 #2
0
 public void dataCreatedCorrectly()
 {
     var patientData1 = new PatientData(firstLine);
     patientDataTestPass1(patientData1);
     var patientData2 = new PatientData(secondLine);
     patientdataTestPass2(patientData2);
 }
コード例 #3
0
 void patientdataTestPass2(PatientData pd)
 {
     Assert.AreEqual(54f, pd.PulseRate);
     Assert.AreEqual(43f, pd.BreathingRate);
     Assert.AreEqual(76f, pd.SystolicRate);
     Assert.AreEqual(86f, pd.DiastolicRate);
     Assert.AreEqual(32f, pd.TemperatureRate);
 }
コード例 #4
0
 void patientDataTestPass1(PatientData pd)
 {
     Assert.AreEqual(70f, pd.PulseRate);
     Assert.AreEqual(35f, pd.BreathingRate);
     Assert.AreEqual(98f, pd.SystolicRate);
     Assert.AreEqual(65f, pd.DiastolicRate);
     Assert.AreEqual(36.5f, pd.TemperatureRate);
 }
コード例 #5
0
        public void DataCreatedCorrectly()
        {
            // Tests whether the data has created correctly aggainst the values passed in during the setup (NW)
            // This is for both the FirstLine and SecondLine (NW)

            var patientData1 = new PatientData(FirstLine);
            PatientDataTestPass1(patientData1);
            var patientData2 = new PatientData(SecondLine);
            PatientdataTestPass2(patientData2);
        }
コード例 #6
0
        public void dataSetCorrectly()
        {
            var patientData = new PatientData();
            patientData.SetPatientData(firstLine);
            patientDataTestPass1(patientData);

            var patientData2 = new PatientData();
            patientData2.SetPatientData(secondLine);
            patientdataTestPass2(patientData2);
        }
コード例 #7
0
 void PatientdataTestPass2(PatientData pd)
 {
     /*
     Same as the above, this test checks whether the values below matches the values setp on the constant string above (SecondLine)
     It checks against every module starting with the the first module which is Module[0]. (NW)
     */
     Assert.AreEqual(54f, pd.Values[0]);
     Assert.AreEqual(43f, pd.Values[1]);
     Assert.AreEqual(76f, pd.Values[2]);
     Assert.AreEqual(86f, pd.Values[3]);
 }
コード例 #8
0
 void PatientDataTestPass1(PatientData pd)
 {
     /*
     Tests whether the values below matches the values setup on the constant string above (FirstLine)
     It checks against every module starting with the first module which is Module[0].(NW)
     */
     Assert.AreEqual(70f, pd.Values[0]);
     Assert.AreEqual(35f, pd.Values[1]);
     Assert.AreEqual(98f, pd.Values[2]);
     Assert.AreEqual(65f, pd.Values[3]);
 }
コード例 #9
0
        public void DataSetCorrectly()
        {
            // Tests whether the data has been set correctly for both FirstLine and SecondLine (NW)
            var patientData = new PatientData();
            patientData.SetPatientData(FirstLine);
            PatientDataTestPass1(patientData);

            var patientData2 = new PatientData();
            patientData2.SetPatientData(SecondLine);
            PatientdataTestPass2(patientData2);
        }
コード例 #10
0
        // Sets up the model of the program
        private void SetupComponents()
        {
            _patientData = (PatientData) _patientFactory.CreateAndReturnObj(PatientClassesEnumeration.PatientData);
            _dataReader =
                (PatientDataReader) _patientFactory.CreateAndReturnObj(PatientClassesEnumeration.PatientDataReader);
            _alarmer = (PatientAlarmer) _patientFactory.CreateAndReturnObj(PatientClassesEnumeration.PatientAlarmer);

            _alarmer.ModuleAlarm += SoundMutableAlarm;

            _tickTimer.Stop();
            _tickTimer.Interval = TimeSpan.FromMilliseconds(1000);
            _tickTimer.Tick += UpdateReadings;
        }