Esempio n. 1
0
        public void TestOhieCr09()
        {
            // Setup the domain authority of TEST
            TestUtil.CreateAuthority("TEST", "2.16.840.1.113883.3.72.5.9.1", "TEST_HARNESS", DeviceSecretA);

            // Setup the domain authority of NID
            TestUtil.CreateAuthority("NID", "2.16.840.1.113883.3.72.5.9.9", "NID_AUTH", DeviceSecretA);

            // Step 1: The test harness verifies that the PIX query handler behaves properly for un-regstered patient
            var message  = TestUtil.GetMessageEvent("OHIE-CR-09-10", DeviceSecretA);
            var response = new PixQbpMessageHandler().HandleMessage(message);

            // Response should be AE
            TestUtil.AssertOutcome(response, "AE");
            var rsp = response as RSP_K23;

            Assert.AreEqual("AE", rsp.QAK.QueryResponseStatus.Value);
            Assert.AreEqual("QPD", rsp.ERR.GetErrorLocation(0).SegmentID.Value);
            Assert.AreEqual("1", rsp.ERR.GetErrorLocation(0).SegmentSequence.Value);
            Assert.AreEqual("3", rsp.ERR.GetErrorLocation(0).FieldPosition.Value);
            Assert.AreEqual("1", rsp.ERR.GetErrorLocation(0).FieldRepetition.Value);
            Assert.AreEqual("1", rsp.ERR.GetErrorLocation(0).ComponentNumber.Value);

            // Harness sends PIX query for unregistered patient in random domain
            message  = TestUtil.GetMessageEvent("OHIE-CR-09-20", DeviceSecretA);
            response = new PixQbpMessageHandler().HandleMessage(message);

            // Response should be AE
            TestUtil.AssertOutcome(response, "AE");
            rsp = response as RSP_K23;
            Assert.AreEqual("AE", rsp.QAK.QueryResponseStatus.Value);
            Assert.AreEqual("QPD", rsp.ERR.GetErrorLocation(0).SegmentID.Value);
            Assert.AreEqual("1", rsp.ERR.GetErrorLocation(0).SegmentSequence.Value);
            Assert.AreEqual("3", rsp.ERR.GetErrorLocation(0).FieldPosition.Value);
            Assert.AreEqual("1", rsp.ERR.GetErrorLocation(0).FieldRepetition.Value);
            Assert.AreEqual("4", rsp.ERR.GetErrorLocation(0).ComponentNumber.Value);

            // Harness sends registering patient
            message  = TestUtil.GetMessageEvent("OHIE-CR-09-30", DeviceSecretA);
            response = new PixAdtMessageHandler().HandleMessage(message);

            // Assert success
            TestUtil.AssertOutcome(response, "AA", "CA");

            // Harness accepts message for xref
            message  = TestUtil.GetMessageEvent("OHIE-CR-09-40", DeviceSecretA);
            response = new PixQbpMessageHandler().HandleMessage(message);

            // Assert success
            TestUtil.AssertOutcome(response, "AA");
            rsp = response as RSP_K23;
            Assert.AreEqual("OK", rsp.QAK.QueryResponseStatus.Value);
            Assert.AreEqual("RJ-443", rsp.QUERY_RESPONSE.PID.GetPatientIdentifierList().Last().IDNumber.Value);
            Assert.AreEqual("TEST", rsp.QUERY_RESPONSE.PID.GetPatientIdentifierList().Last().AssigningAuthority.NamespaceID.Value);
            Assert.AreEqual("2.16.840.1.113883.3.72.5.9.1", rsp.QUERY_RESPONSE.PID.GetPatientIdentifierList().Last().AssigningAuthority.UniversalID.Value);
            Assert.AreEqual("ISO", rsp.QUERY_RESPONSE.PID.GetPatientIdentifierList().Last().AssigningAuthority.UniversalIDType.Value);
        }
Esempio n. 2
0
        public void TestOhieCr10()
        {
            TestUtil.CreateAuthority("TEST", "2.16.840.1.113883.3.72.5.9.1", "TEST_HARNESS", DeviceSecretA);
            TestUtil.CreateAuthority("NID", "2.16.840.1.113883.3.72.5.9.9", "NID_AUTH", DeviceSecretA);

            // Ensure that patient is registered
            var message  = TestUtil.GetMessageEvent("OHIE-CR-10-10", DeviceSecretA);
            var response = new PixAdtMessageHandler().HandleMessage(message);

            TestUtil.AssertOutcome(response, "AA", "CA");

            // Test harness requests that the receiver gives it only TEST identities
            message  = TestUtil.GetMessageEvent("OHIE-CR-10-20", DeviceSecretA);
            response = new PixQbpMessageHandler().HandleMessage(message);
            TestUtil.AssertOutcome(response, "AA");
            var rsp = response as RSP_K23;

            Assert.AreEqual(1, rsp.QUERY_RESPONSE.PID.PatientIdentifierListRepetitionsUsed);
            Assert.AreEqual("RJ-444", rsp.QUERY_RESPONSE.PID.GetPatientIdentifierList().First().IDNumber.Value);
            Assert.AreEqual("TEST", rsp.QUERY_RESPONSE.PID.GetPatientIdentifierList().First().AssigningAuthority.NamespaceID.Value);
            Assert.AreEqual("2.16.840.1.113883.3.72.5.9.1", rsp.QUERY_RESPONSE.PID.GetPatientIdentifierList().First().AssigningAuthority.UniversalID.Value);

            // Test harness requests receiver to give it a domain that does not exist
            message  = TestUtil.GetMessageEvent("OHIE-CR-10-30", DeviceSecretA);
            response = new PixQbpMessageHandler().HandleMessage(message);
            TestUtil.AssertOutcome(response, "AE");
            rsp = response as RSP_K23;
            Assert.AreEqual("AE", rsp.QAK.QueryResponseStatus.Value);
            Assert.AreEqual("QPD", rsp.ERR.GetErrorLocation(0).SegmentID.Value);
            Assert.AreEqual("4", rsp.ERR.GetErrorLocation(0).FieldPosition.Value);

            // Test harness requests recevier giv it a domain identifier from valid domain but for which the patient has no ID
            message  = TestUtil.GetMessageEvent("OHIE-CR-10-40", DeviceSecretA);
            response = new PixQbpMessageHandler().HandleMessage(message);
            TestUtil.AssertOutcome(response, "AA");
            rsp = response as RSP_K23;
            Assert.AreEqual("NF", rsp.QAK.QueryResponseStatus.Value);
            Assert.AreEqual(0, rsp.QUERY_RESPONSE.PID.PatientIdentifierListRepetitionsUsed);
        }