コード例 #1
0
        public virtual void TestParseWithMaximumViolation()
        {
            XmlNode node = CreateNode("<top><telecom specializationType=\"TEL.PHONE\" value=\"tel:+1-519-555-2345;ext=1\"/>" + "<telecom specializationType=\"TEL.PHONE\" value=\"tel:+1-519-555-2345;ext=2\"/>"
                                      + "<telecom specializationType=\"TEL.PHONE\" value=\"tel:+1-519-555-2345;ext=3\"/>" + "<telecom specializationType=\"TEL.PHONE\" value=\"tel:+1-416-555-2345;ext=4\"/></top>"
                                      );
            BareANY result = new ListElementParser(this.parserRegistry).Parse(ParseContextImpl.Create("LIST<TEL.PHONEMAIL>", null, SpecificationVersion
                                                                                                      .V02R02, null, null, null, Cardinality.Create("1-2"), null, false), AsList(node.ChildNodes), this.xmlResult);

            Assert.IsFalse(this.xmlResult.IsValid());
            Assert.AreEqual(1, this.xmlResult.GetHl7Errors().Count);
            Assert.AreEqual("Number of elements (4) is more than the specified maximum (2)", this.xmlResult.GetHl7Errors()[0].GetMessage
                                ());
            IList <TelecommunicationAddress> list = ((LIST <TEL, TelecommunicationAddress>)result).RawList();

            Assert.IsNotNull(list, "null");
            Assert.AreEqual(4, list.Count, "size");
            TelecommunicationAddress phone1 = list[0];
            TelecommunicationAddress phone2 = list[1];
            TelecommunicationAddress phone3 = list[2];
            TelecommunicationAddress phone4 = list[3];

            Assert.AreEqual("+1-519-555-2345;ext=1", phone1.Address);
            Assert.AreEqual("+1-519-555-2345;ext=2", phone2.Address);
            Assert.AreEqual("+1-519-555-2345;ext=3", phone3.Address);
            Assert.AreEqual("+1-416-555-2345;ext=4", phone4.Address);
        }
コード例 #2
0
        public virtual void TestParse()
        {
            XmlNode node = CreateNode("<top><telecom specializationType=\"TEL.PHONE\" value=\"tel:+1-519-555-2345;ext=1\"/>" + "<telecom specializationType=\"TEL.PHONE\" value=\"tel:+1-416-555-2345;ext=2\"/></top>"
                                      );
            BareANY result = new ListElementParser(this.parserRegistry).Parse(ParseContextImpl.Create("LIST<TEL.PHONEMAIL>", null, SpecificationVersion
                                                                                                      .V02R02, null, null, null, Cardinality.Create("0-4"), null, false), AsList(node.ChildNodes), this.xmlResult);

            Assert.IsTrue(this.xmlResult.IsValid());
            IList <TelecommunicationAddress> list = ((LIST <TEL, TelecommunicationAddress>)result).RawList();

            Assert.IsNotNull(list, "null");
            Assert.AreEqual(2, list.Count, "size");
            TelecommunicationAddress phone1 = list[0];
            TelecommunicationAddress phone2 = list[1];

            Assert.AreEqual("+1-519-555-2345;ext=1", phone1.Address);
            Assert.AreEqual("+1-416-555-2345;ext=2", phone2.Address);
        }
コード例 #3
0
        public virtual void TestParse()
        {
            XmlNode node = CreateNode("<top><name><family>Flinstone</family><given>Fred</given></name>" + "<name><family>Flinstone</family><given>Wilma</given></name></top>"
                                      );
            BareANY result = new ListElementParser(ParserRegistry.GetInstance()).Parse(ParseContextImpl.Create("LIST<PN>", null, SpecificationVersion
                                                                                                               .V02R02, null, null, Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.MANDATORY, Cardinality.Create("1-5"), null, false),
                                                                                       AsList(node.ChildNodes), this.xmlResult);
            IList <PersonName> list = ((LIST <PN, PersonName>)result).RawList();

            Assert.IsNotNull(list, "null");
            Assert.AreEqual(2, list.Count, "size");
            EntityName fred  = list[0];
            EntityName wilma = list[1];

            Assert.AreEqual("Flinstone", fred.Parts[0].Value);
            Assert.AreEqual("Fred", fred.Parts[1].Value);
            Assert.AreEqual("Flinstone", wilma.Parts[0].Value);
            Assert.AreEqual("Wilma", wilma.Parts[1].Value);
        }
コード例 #4
0
        public virtual void TestParse()
        {
            XmlNode node = CreateNode("<top>" + "<something specializationType=\"TEL.EMAIL\" value=\"mailto://Fred\"/>" + "<something specializationType=\"TEL.EMAIL\" value=\"mailto://Wilma\"/>"
                                      + "</top>");
            BareANY result = new ListElementParser(ParserRegistry.GetInstance()).Parse(ParseContextImpl.Create("LIST<TEL.PHONEMAIL>",
                                                                                                               null, SpecificationVersion.V02R02, null, null, null, Cardinality.Create("1-5"), null, false), AsList(node.ChildNodes), null
                                                                                       );
            IList <TelecommunicationAddress> list = ((LIST <TEL, TelecommunicationAddress>)result).RawList();

            Assert.IsNotNull(list, "null");
            Assert.AreEqual(2, list.Count, "size");
            ICollection <string> expectedStrings = new HashSet <string>();

            expectedStrings.Add("Fred");
            expectedStrings.Add("Wilma");
            foreach (TelecommunicationAddress address in list)
            {
                Assert.AreEqual(CeRxDomainTestValues.MAILTO.CodeValue, address.UrlScheme.CodeValue, "urlscheme");
                Assert.IsTrue(expectedStrings.Contains(address.Address), "expected set contains address");
                expectedStrings.Remove(address.Address);
            }
        }