public void testVideoApptReady()
        {
            MessagingEngine engine = makeEngine();

            engine.TimeNow = new DateTime(2021, 1, 1, 13, 1, 0);
            reset();
            List <PmsAppointment> appts = new List <PmsAppointment>();

            // set it up:
            appts.Add(appt10am());
            appts.Add(appt1pm());
            appts[1].ExternalData.ScreeningMessageSent = true;
            appts[1].ArrivalStatus = AppointmentStatus.Arrived;
            appts[1].ExternalData.ArrivalStatus = AppointmentStatus.Arrived;
            appts[1].ArrivalStatus = AppointmentStatus.Fulfilled;
            appts[1].ExternalData.ArrivalStatus = AppointmentStatus.Arrived;

            // run it
            engine.ProcessTodaysAppointments(appts);
            // inspect outputs:
            Assert.AreEqual(1, OutputMsgs.Count);
            Assert.AreEqual("+61411012345", OutputMsgs[0].phone);
            Assert.AreEqual("The doctor is ready to see you now. Please go to room 7.", OutputMsgs[0].message);
            Assert.AreEqual(1, StorageOps.Count);
            Assert.AreEqual("1002", StorageOps[0].Appointment.AppointmentFhirID);
            Assert.IsTrue(StorageOps[0].Appointment.ArrivalStatus == AppointmentStatus.Fulfilled);
            Assert.IsTrue(StorageOps[0].Appointment.ExternalData.ArrivalStatus == AppointmentStatus.Fulfilled);
        }
        public void testNothingToDo()
        {
            MessagingEngine engine = makeEngine();

            engine.TimeNow = new DateTime(2021, 1, 1, 10, 55, 0);
            reset();
            List <PmsAppointment> appts = new List <PmsAppointment>();

            // set it up:
            appts.Add(appt10am());
            appts.Add(appt2pm());
            // run it
            engine.ProcessTodaysAppointments(appts);
            // inspect outputs:
            Assert.AreEqual(0, OutputMsgs.Count);
            Assert.AreEqual(0, StorageOps.Count);
        }
        public void testScreeningMsgDone()
        {
            MessagingEngine engine = makeEngine();

            engine.TimeNow = new DateTime(2021, 1, 1, 10, 56, 0);
            reset();
            List <PmsAppointment> appts = new List <PmsAppointment>();

            // set it up:
            appts.Add(appt10am());
            appts.Add(appt1pm());
            appts[1].ExternalData.ScreeningMessageSent = true;
            // run it
            engine.ProcessTodaysAppointments(appts);
            // inspect outputs:
            Assert.AreEqual(0, OutputMsgs.Count);
            Assert.AreEqual(0, StorageOps.Count);
        }
        public void testScreeningMsgNoDoctor()
        {
            MessagingEngine engine = makeEngine();

            engine.TimeNow = new DateTime(2021, 1, 1, 10, 55, 0);
            reset();
            engine.RoomMappings[0].IgnoreThisDoctor = true;
            List <PmsAppointment> appts = new List <PmsAppointment>();

            // set it up:
            appts.Add(appt10am());
            appts.Add(appt1pm());
            // run it
            engine.ProcessTodaysAppointments(appts);
            // inspect outputs:
            Assert.AreEqual(0, OutputMsgs.Count);
            Assert.AreEqual(0, StorageOps.Count);
        }
        public void testScreeningMsg()
        {
            MessagingEngine engine = makeEngine();

            engine.TimeNow = new DateTime(2021, 1, 1, 10, 55, 0);
            reset();
            List <PmsAppointment> appts = new List <PmsAppointment>();

            // set it up:
            appts.Add(appt10am());
            appts.Add(appt1pm());
            // run it
            engine.ProcessTodaysAppointments(appts);
            // inspect outputs:
            Assert.AreEqual(1, OutputMsgs.Count);
            Assert.AreEqual("+61411012345", OutputMsgs[0].phone);
            Assert.AreEqual("Please consult the web page http://www.rcpa.org.au/xxx to determine whether you are eligible to meet with the doctor by phone/video. If you are, respond to this message with YES otherwise respond with NO", OutputMsgs[0].message);
            Assert.AreEqual(1, StorageOps.Count);
            Assert.AreEqual("1002", StorageOps[0].Appointment.AppointmentFhirID);
            Assert.IsTrue(StorageOps[0].Appointment.ExternalData.ScreeningMessageSent);
        }
        public void testScreeningMsgNoVideo()
        {
            MessagingEngine engine = makeEngine();

            engine.TimeNow = new DateTime(2021, 1, 1, 10, 55, 0);
            reset();
            engine.RoomMappings[0].NoVideoForThisDoctor = true;
            List <PmsAppointment> appts = new List <PmsAppointment>();

            // set it up:
            appts.Add(appt10am());
            appts.Add(appt1pm());
            // run it
            engine.ProcessTodaysAppointments(appts);
            // 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. When you arrive at the clinic, stay in your car (or outside the clinic) and reply \"arrived\" to this message. If you have any potential symptoms of Covid-19, or exposure to a known case, you MUST advise the Doctor and staff by telephone in advance of your appointment", OutputMsgs[0].message);

            Assert.AreEqual(1, StorageOps.Count);
            Assert.AreEqual("1002", StorageOps[0].Appointment.AppointmentFhirID);
            Assert.IsTrue(StorageOps[0].Appointment.ExternalData.ScreeningMessageSent);
        }
        public void testVideoInviteNow()
        {
            MessagingEngine engine = makeEngine();

            engine.TimeNow = new DateTime(2021, 1, 1, 12, 51, 0);
            reset();
            List <PmsAppointment> appts = new List <PmsAppointment>();

            // set it up:
            appts.Add(appt10am());
            appts.Add(appt1pm());
            appts[1].ExternalData.ScreeningMessageSent = true;
            appts[1].IsVideoConsultation = true;

            // run it
            engine.ProcessTodaysAppointments(appts);
            // inspect outputs:
            Assert.AreEqual(1, OutputMsgs.Count);
            Assert.AreEqual("+61411012345", OutputMsgs[0].phone);
            Assert.AreEqual("Please start your video call at https://meet.jit.si/:guid:-1002. When you have started it, reply to this message with the word \"joined\"", OutputMsgs[0].message);
            Assert.AreEqual(1, StorageOps.Count);
            Assert.AreEqual("1002", StorageOps[0].Appointment.AppointmentFhirID);
            Assert.IsTrue(StorageOps[0].Appointment.ExternalData.VideoInviteSent);
        }