public void testVideoJoinedDuh() { MessagingEngine engine = makeEngine(); 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", "ok ready")); // run it engine.ProcessIncomingMessages(appts, msgs); // inspect outputs: Assert.AreEqual(1, OutputMsgs.Count); Assert.AreEqual("+61411012345", OutputMsgs[0].phone); Assert.AreEqual("The robot processing this message is stupid, and didn't understand your response. Please just say \"joined\" when you have joined the video call", OutputMsgs[0].message); Assert.AreEqual(0, StorageOps.Count); }
public void testUnexpected() { MessagingEngine engine = makeEngine(); 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].ArrivalStatus = AppointmentStatus.Fulfilled; 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("Patient Test Patient #2 has an appointment with Dr Adam Ant at 01:00 PM on 1-Jan, but this robot is not expecting a message right now", OutputMsgs[0].message); Assert.AreEqual(0, StorageOps.Count); }
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 testArrivedDuh() { MessagingEngine engine = makeEngine(); 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", "I'm here")); // run it engine.ProcessIncomingMessages(appts, msgs); // inspect outputs: Assert.AreEqual(1, OutputMsgs.Count); Assert.AreEqual("+61411012345", OutputMsgs[0].phone); Assert.AreEqual("The robot processing this message is stupid, and didn't understand your response. Please just say \"arrived\", or phone {num} for help", OutputMsgs[0].message); Assert.AreEqual(0, StorageOps.Count); }
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 testScreeningResponseNo() { MessagingEngine engine = makeEngine(); 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", "NO!")); // run it engine.ProcessIncomingMessages(appts, msgs); // inspect outputs: Assert.AreEqual(1, OutputMsgs.Count); Assert.AreEqual("+61411012345", OutputMsgs[0].phone); Assert.AreEqual("Thank you. When you arrive at the clinic, stay in your car (or outside) and reply \"arrived\" to this message", 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 == false); }
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); }
public void testIncomingUnkPhone() { MessagingEngine engine = makeEngine(); 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()); msgs.Add(new SmsMessage("+61411012346", "Arrived")); // run it engine.ProcessIncomingMessages(appts, msgs); // inspect outputs: Assert.AreEqual(1, OutputMsgs.Count); Assert.AreEqual("+61411012346", OutputMsgs[0].phone); Assert.AreEqual("This phone number is not associated with an appointment to see the doctor today. Please phone {num} for help", OutputMsgs[0].message); Assert.AreEqual(0, StorageOps.Count); }