public void TestPositiveAckPrepareForSpecimenResponse()
        {
            PrepareForSpecimenResponse prepare = new PrepareForSpecimenResponse();

            HL7Parser p = new HL7Parser();

            ParserResult result = p.Parse(prepare.Encode());

            Assert.IsTrue(result.MessageAccepted);

            Assert.IsTrue(result.Acknowledge.IsAckForRequest(prepare));
        }
        public void CreatePrepareForSpecimenResponse()
        {
            PrepareForSpecimenResponse request = new PrepareForSpecimenResponse();

            //Assert.IsAssignableFrom(typeof(EAC_U07), request.EAC_U07);

            Assert.That(request.MessageDateTime.ToString("yyyyMMddHHmmss"), Does.Match(""));

            Assert.AreEqual("EAR", request.MessageCode);

            Assert.AreEqual("U08", request.TriggerEvent);

            Guid g = new Guid();

            Assert.IsTrue(Guid.TryParse(request.ControlID, out g));

            Assert.IsFalse(g.ToString() == "00000000-0000-0000-0000-000000000000");

            string msg = request.Encode();

            Debug.Print(msg);
        }
Exemple #3
0
        public async Task N_HL7InterfaceSendsCommandToHL7InterfaceWaitAckAndResponse()
        {
            CreateAndConfigureA(true, false);
            CreateAndConfigureB(true, true);

            AutoResetEvent ackReceived = new AutoResetEvent(false);

            AutoResetEvent commandResponseReceived = new AutoResetEvent(false);

            Assert.That(hl7InterfaceA.Start());

            hl7InterfaceA.NewRequestReceived += async(s, e) =>
            {
                PrepareForSpecimenResponse rsp = new PrepareForSpecimenResponse()
                {
                    RequestID = e.Request.MessageID
                };

                Assert.That(await hl7InterfaceA.ConnectAsync(endPointB));

                await hl7InterfaceA.SendHL7MessageAsync(rsp);
            };

            Assert.That(hl7InterfaceB.Start());

            PrepareForSpecimenRequest request = new PrepareForSpecimenRequest();

            Assert.That(await hl7InterfaceB.ConnectAsync(endPointA));

            var result = await hl7InterfaceB.SendHL7MessageAsync(request);

            Assert.IsTrue(result.Acknowledgment != null);

            Assert.IsTrue(HL7Parser.IsAckForRequest(request, result.Acknowledgment));

            Assert.IsTrue(result.Response.IsResponseForRequest(request));

            hl7InterfaceA.Stop(); hl7InterfaceB.Stop();
        }