Beispiel #1
0
        public virtual void TestShouldReadSampleXmlWithBreadcrumbHistory()
        {
            MessageSet testset = GetMessageSet("sample_with_breadcrumbs.xml");

            Assert.IsTrue(testset.RemixHistory.Count > 0);
            Assert.AreEqual(testset.RemixHistory[0].Value, "R02_04_02");
        }
Beispiel #2
0
        public virtual void TestShouldReadSampleXml()
        {
            MessageSet set = GetMessageSet("sample.xml");

            Assert.IsNotNull(set, "set");
            Assert.AreEqual(2, set.PackageLocations.SafeGet("COCT_MT470002CA").MessageParts.Count, "number of parts");
            Assert.AreEqual(new Cardinality(1, 1), set.GetMessagePart("COCT_MT470002CA.ActDefinition").Relationships[0].Cardinality,
                            "cardinality");
        }
Beispiel #3
0
        /// <exception cref="System.Exception"></exception>
        private MessageSet MarshallAndUnmarshall(MessageSet set)
        {
            MemoryStream output = new MemoryStream();

            this.marshaller.Marshall(set, output);
            byte[] b = output.ToArray();
            System.Console.Out.WriteLine(System.Text.ASCIIEncoding.ASCII.GetString(b));
            return(this.marshaller.Unmarshall(new MemoryStream(b)));
        }
Beispiel #4
0
        public virtual void TestShouldReadSampleWithRimClass()
        {
            MessageSet testset = GetMessageSet("sample_with_rim_class.xml");
            ICollection <MessagePart> allMessageParts = testset.AllMessageParts;

            foreach (MessagePart messagePart in allMessageParts)
            {
                Assert.IsNotNull(messagePart.RimClass);
            }
        }
Beispiel #5
0
        public virtual void TestWriteXml()
        {
            MessageSet  set         = new MessageSet();
            Interaction interaction = new Interaction();

            interaction.Name                    = "ABCD_IN000001CA";
            interaction.SuperTypeName           = "MCCI_IN002100CA.Message";
            set.Interactions["ABCD_IN000001CA"] = interaction;
            MessageSet newSet = MarshallAndUnmarshall(set);

            Assert.AreEqual(set.Interactions.Count, newSet.Interactions.Count, "interactions");
        }
Beispiel #6
0
        /// <exception cref="System.Exception"></exception>
        public static void Main(string[] args)
        {
            //		File file = new File("../message-builder-hl7v3-release-pcs_mr2007_v02_r02/src/main/resources/messageSet_v02_r02.xml");
            //		File file = new File("../message-builder-hl7v3-release-pcs_cerx_v01_r04_3/src/main/resources/messageSet_v01r04_3.xml");
            //		File file = new File("../message-builder-release-newfoundland/src/main/resources/messageSet_NEWFOUNDLAND.xml");
            //		File file = new File("../message-builder-hl7v3-release-pcs_mr2009_r02_04_02/src/main/resources/messageSet_r02_04_02.xml");
            FileInfo file = new FileInfo("../message-builder-xml-validation/src/test/resources/ca/infoway/messagebuilder/xml/validator/messageSet_v02r02.xml"
                                         );
            MessageSetMarshaller marshaller = new MessageSetMarshaller();
            MessageSet           messageSet = marshaller.Unmarshall(file);

            marshaller.Marshall(messageSet, file);
        }
Beispiel #7
0
        public virtual void TestWriteXmlWithNesting()
        {
            MessageSet  set         = new MessageSet();
            Interaction interaction = new Interaction();

            interaction.Name          = "ABCD_IN000001CA";
            interaction.SuperTypeName = "MCCI_IN002100CA.Message";
            Argument triggerEvent = new Argument();

            triggerEvent.Name = "REPC_MT123456CA.ControlActEvent";
            Argument payload = new Argument();

            payload.Name = "REPC_MT123456CA.Payload";
            triggerEvent.Arguments.Add(payload);
            interaction.Arguments.Add(triggerEvent);
            set.Interactions["ABCD_IN000001CA"] = interaction;
            MessageSet newSet = MarshallAndUnmarshall(set);

            Assert.AreEqual(set.Interactions.Count, newSet.Interactions.Count, "interactions");
        }
Beispiel #8
0
        public virtual void TestShouldReadSampleXmlWithArgumentChoices()
        {
            MessageSet set = GetMessageSet("sample_with_argument_choices.xml");

            Assert.IsNotNull(set, "set");
        }
Beispiel #9
0
 /// <summary>Marshall a message set to an output stream.</summary>
 /// <remarks>Marshall a message set to an output stream.</remarks>
 /// <param name="domain">- the message set to marshall</param>
 /// <param name="file">- the file to write to</param>
 /// <exception cref="System.Exception">- if any underlying exception occurs</exception>
 public virtual void Marshall(MessageSet domain, FileInfo file)
 {
     this.serializer.Write(domain, file);
 }
Beispiel #10
0
 /// <summary>Marshall a message set to an output stream.</summary>
 /// <remarks>Marshall a message set to an output stream.</remarks>
 /// <param name="domain">- the message set to marshall</param>
 /// <param name="output">- the output stream</param>
 /// <exception cref="System.Exception">- if any underlying exception occurs</exception>
 public virtual void Marshall(MessageSet domain, Stream output)
 {
     this.serializer.Write(domain, output);
 }