예제 #1
0
        public void Create_NewBundle()
        {
            // Arrange
            var itk = new ITKMessage();

            // Act
            var bundle = itk.GenerateBundle();

            // Assert
            Assert.NotNull(bundle);
            Assert.Equal(bundle.Meta.Profile.ElementAt(0), ITKConstants.Profile_Bundle);
        }
예제 #2
0
        public void Create_NewBundleWithId(string testId)
        {
            // Arrange
            var itk = new ITKMessage(testId);

            // Act
            var bundle = itk.GenerateBundle();

            // Assert
            Assert.NotNull(bundle);
            Assert.Equal(bundle.Identifier.Value, testId);
        }
예제 #3
0
        static void Main(string[] args)
        {
            var itk = new ITKMessage("d12dc439-ca5c-4177-bb70-4fece88edab0");

            itk.Event(ITKMessageEventCode.ITKImmunizationDocument);

            var receiver = new ITKOrganization();

            receiver.SetODSOrgCode("ABC123");

            var senderName = new HumanName
            {
                Family = "Rastall",
                Given  = new String[] { "Stephen", "David" },
                Prefix = new String[] { "Mr" }
            };

            var sender = new ITKPractitioner();

            sender.SetSDSUserID("033345750518");
            sender.AddSDSRoleProfileId("XYZ989");
            sender.SetName(senderName);

            itk.Sender(sender);



            itk.Receiver(receiver);

            itk.SourceEndpoint("1.2.826.0.1285.0.2.0.107");

            // A series of "message handling flags"
            itk.SetBusinessAck(true);
            itk.SetInfrastructureAck(false);
            itk.SetRecipientType(ITKRecipientType.ForAction);
            itk.SetSenderReference("Test Message Ignore");
            itk.SetMessageDefinition("https://fhir.nhs.uk/STU3/MessageDefinition/ITK-EDIS-MessageDefinition-1");
            itk.SetLocalExtension(new FhirBoolean(true));

            itk.Focus = new Bundle()
            {
                Id = "test"
            };                                        // This is where the payload for the ITK message would go

            var rawxml = new FhirXmlSerializer().SerializeToString(itk.GenerateBundle());

            File.WriteAllText("Test02.xml", rawxml);
        }
예제 #4
0
        public void Set_Event()
        {
            // Arrange
            var itk = new ITKMessage();

            itk.Event(ITKMessageEventCode.ITKImmunizationDocument);

            // Act
            var bundle = itk.GenerateBundle();
            var mh     = bundle.Entry[0].Resource as MessageHeader;

            // Assert

            Assert.NotNull(bundle);
            Assert.NotNull(mh);
            Assert.Equal("ITK009D", mh.Event.Code);
            Assert.Equal("ITK Digital Medicine Immunization Document", mh.Event.Display);
            Assert.Equal(ITKConstants.System_Message_Event, mh.Event.System);
        }