public void testArrived() { MessagingEngine engine = makeEngine(); var fhirServerUpdater = new MessageLogicFhirUpdaterHandler(this); engine.AppointmentUpdater = fhirServerUpdater; engine.TimeNow = new DateTime(2021, 1, 1, 12, 58, 0); reset(); List <PmsAppointment> appts = new List <PmsAppointment>(); List <SmsMessage> msgs = new List <SmsMessage>(); // set it up: appts.Add(appt10am()); appts.Add(appt1pm()); appts[1].ExternalData.ScreeningMessageSent = true; appts[1].ExternalData.ScreeningMessageResponse = true; msgs.Add(new SmsMessage("+61411012345", "ARRIVED")); // run it engine.ProcessIncomingMessages(appts, msgs); // inspect outputs: Assert.AreEqual(1, OutputMsgs.Count); Assert.AreEqual("+61411012345", OutputMsgs[0].phone); Assert.AreEqual("Thanks for letting us know that you're here. We'll let you know as soon as the doctor is ready for you", OutputMsgs[0].message); Assert.AreEqual(1, StorageOps.Count); Assert.AreEqual("1002", StorageOps[0].Appointment.AppointmentFhirID); Assert.AreEqual("save-appt", StorageOps[0].type); Assert.AreEqual(AppointmentStatus.Arrived, StorageOps[0].Appointment.ArrivalStatus); Assert.AreEqual(AppointmentStatus.Arrived, StorageOps[0].Appointment.ExternalData.ArrivalStatus); Assert.AreEqual("save-status", FhirUpdateOps[0].type); Assert.AreEqual(AppointmentStatus.Arrived, FhirUpdateOps[0].status); }
public void testVideoJoined() { MessagingEngine engine = makeEngine(); var fhirServerUpdater = new MessageLogicFhirUpdaterHandler(this); engine.AppointmentUpdater = fhirServerUpdater; engine.TimeNow = new DateTime(2021, 1, 1, 12, 58, 0); reset(); List <PmsAppointment> appts = new List <PmsAppointment>(); List <SmsMessage> msgs = new List <SmsMessage>(); // set it up: appts.Add(appt10am()); appts.Add(appt1pm()); appts[1].ExternalData.ScreeningMessageSent = true; appts[1].ExternalData.ScreeningMessageResponse = true; appts[1].IsVideoConsultation = true; appts[1].ExternalData.VideoInviteSent = true; msgs.Add(new SmsMessage("+61411012345", "Joined")); // run it engine.ProcessIncomingMessages(appts, msgs); // inspect outputs: Assert.AreEqual(1, OutputMsgs.Count); Assert.AreEqual("+61411012345", OutputMsgs[0].phone); Assert.AreEqual("Thank you. The Doctor will join you as soon as possible", OutputMsgs[0].message); Assert.AreEqual(1, StorageOps.Count); Assert.AreEqual("1002", StorageOps[0].Appointment.AppointmentFhirID); Assert.IsTrue(StorageOps[0].Appointment.ArrivalStatus == AppointmentStatus.Arrived); Assert.IsTrue(StorageOps[0].Appointment.ExternalData.ArrivalStatus == AppointmentStatus.Arrived); Assert.AreEqual("save-status", FhirUpdateOps[0].type); Assert.AreEqual(AppointmentStatus.Arrived, FhirUpdateOps[0].status); }
public void testScreeningResponseYes() { MessagingEngine engine = makeEngine(); var fhirServerUpdater = new MessageLogicFhirUpdaterHandler(this); engine.AppointmentUpdater = fhirServerUpdater; engine.TimeNow = new DateTime(2021, 1, 1, 13, 0, 0); reset(); List <PmsAppointment> appts = new List <PmsAppointment>(); List <SmsMessage> msgs = new List <SmsMessage>(); // set it up: appts.Add(appt10am()); appts.Add(appt1pm()); appts[1].ExternalData.ScreeningMessageSent = true; msgs.Add(new SmsMessage("+61411012345", "Yes")); // run it engine.ProcessIncomingMessages(appts, msgs); // inspect outputs: Assert.AreEqual(1, OutputMsgs.Count); Assert.AreEqual("+61411012345", OutputMsgs[0].phone); Assert.AreEqual("Thank you. Do not come to the doctor's clinic. You will get an SMS message containing the URL for your video meeting a few minutes before your appointment. You can join from any computer or smartphone", OutputMsgs[0].message); Assert.AreEqual(1, StorageOps.Count); Assert.AreEqual("1002", StorageOps[0].Appointment.AppointmentFhirID); Assert.IsTrue(StorageOps[0].Appointment.ExternalData.ScreeningMessageSent == true); Assert.IsTrue(StorageOps[0].Appointment.ExternalData.ScreeningMessageResponse == true); Assert.IsTrue(StorageOps[0].Appointment.IsVideoConsultation == true); Assert.AreEqual("save-video-meeting", FhirUpdateOps[0].type); Assert.IsNotNull(FhirUpdateOps[0].comment); }