Esempio n. 1
0
        public virtual void TestUsesForMr2009()
        {
            EnR2PropertyFormatter formatter  = new EnR2PropertyFormatter();
            PersonName            personName = new PersonName();

            personName.AddUse(Ca.Infoway.Messagebuilder.Domainvalue.Basic.EntityNameUse.LEGAL);
            personName.AddNamePart(new EntityNamePart("Steve Shaw"));
            string result = formatter.Format(GetContext("name", "PN", SpecificationVersion.R02_04_03), new PNImpl(personName));

            Assert.IsTrue(this.result.IsValid());
            AssertXml("something in text node", "<name use=\"L\">Steve Shaw</name>", result, true);
            this.result.ClearErrors();
            personName.Uses.Clear();
            personName.AddUse(Ca.Infoway.Messagebuilder.Domainvalue.Basic.EntityNameUse.PSEUDONYM);
            result = formatter.Format(GetContext("name", "PN", SpecificationVersion.R02_04_03), new PNImpl(personName));
            Assert.IsTrue(this.result.IsValid());
            AssertXml("something in text node", "<name use=\"P\">Steve Shaw</name>", result, true);
            this.result.ClearErrors();
            personName.Uses.Clear();
            personName.AddUse(Ca.Infoway.Messagebuilder.Domainvalue.Basic.EntityNameUse.LICENSE);
            result = formatter.Format(GetContext("name", "PN", SpecificationVersion.R02_04_03), new PNImpl(personName));
            Assert.IsTrue(this.result.IsValid());
            AssertXml("something in text node", "<name use=\"C\">Steve Shaw</name>", result, true);
            this.result.ClearErrors();
            personName.Uses.Clear();
            personName.AddUse(Ca.Infoway.Messagebuilder.Domainvalue.Basic.EntityNameUse.OFFICIAL_REGISTRY);
            result = formatter.Format(GetContext("name", "PN", SpecificationVersion.R02_04_03), new PNImpl(personName));
            Assert.IsTrue(this.result.IsValid());
            AssertXml("something in text node", "<name use=\"OR\">Steve Shaw</name>", result, true);
        }
Esempio n. 2
0
        public virtual void TestFormatValueNonNull()
        {
            EnR2PropertyFormatter formatter = new EnR2PropertyFormatter();
            string result = formatter.Format(GetContext("name", "TN"), new TNImpl(new TrivialName("something")));

            Assert.IsTrue(this.result.IsValid());
            AssertXml("something in text node", "<name>something</name>", result, true);
        }
Esempio n. 3
0
        public virtual void TestFormatValueReservedXmlChars()
        {
            EnR2PropertyFormatter formatter   = new EnR2PropertyFormatter();
            TrivialName           trivialName = new TrivialName("<cats think they're > humans & dogs 99% of the time/>");
            string result = formatter.Format(GetContext("name", "TN"), new TNImpl(trivialName));

            Assert.IsTrue(this.result.IsValid());
            AssertXml("something in text node", "<name>&lt;cats think they&apos;re &gt; humans &amp; dogs 99% of the time/&gt;</name>"
                      , result, true);
        }
Esempio n. 4
0
        public virtual void TestFormatValueNonNullNoUse()
        {
            EnR2PropertyFormatter formatter  = new EnR2PropertyFormatter();
            PersonName            personName = new PersonName();

            personName.AddNamePart(new EntityNamePart("Steve Shaw"));
            string result = formatter.Format(GetContext("name", "PN", SpecificationVersion.R02_04_02), new PNImpl(personName));

            Assert.IsTrue(this.result.IsValid());
            AssertXml("something in text node", "<name>Steve Shaw</name>", result, true);
        }
Esempio n. 5
0
        public virtual void TestFormatSimpleNoParts()
        {
            EnR2PropertyFormatter formatter  = new EnR2PropertyFormatter();
            PersonName            personName = new PersonName();

            personName.AddUse(Ca.Infoway.Messagebuilder.Domainvalue.Basic.EntityNameUse.LEGAL);
            string result = formatter.Format(GetContext("name", "PN", SpecificationVersion.R02_04_02), new PNImpl(personName));

            Assert.IsTrue(this.result.IsValid());
            AssertXml("something in text node", "<name use=\"L\"></name>", result, true);
        }
Esempio n. 6
0
        public virtual void TestFormatValueNonNull()
        {
            EnR2PropertyFormatter formatter        = new EnR2PropertyFormatter();
            OrganizationName      organizationName = new OrganizationName();

            organizationName.AddNamePart(new EntityNamePart("Organization"));
            string result = formatter.Format(GetContext("name", "ON"), new ONImpl(organizationName));

            Assert.IsTrue(this.result.IsValid());
            AssertXml("something in text node", "<name>Organization</name>", result, true);
        }
Esempio n. 7
0
        public virtual void TestFormatValueNonNullInvalidPart()
        {
            EnR2PropertyFormatter formatter   = new EnR2PropertyFormatter();
            TrivialName           trivialName = new TrivialName();

            trivialName.AddNamePart(new EntityNamePart("something", PersonNamePartType.FAMILY));
            string result = formatter.Format(GetContext("name", "TN"), new TNImpl(trivialName));

            Assert.IsFalse(this.result.IsValid());
            Assert.AreEqual(1, this.result.GetHl7Errors().Count);
            AssertXml("something in text node", "<name><family>something</family></name>", result, true);
        }
Esempio n. 8
0
        public virtual void TestFormatValueReservedXmlChars()
        {
            EnR2PropertyFormatter formatter        = new EnR2PropertyFormatter();
            OrganizationName      organizationName = new OrganizationName();

            organizationName.AddNamePart(new EntityNamePart("<cats think they're > humans & dogs 99% of the time/>"));
            string result = formatter.Format(GetContext("name", "ON"), new ONImpl(organizationName));

            Assert.IsTrue(this.result.IsValid());
            AssertXml("something in text node", "<name>&lt;cats think they&apos;re &gt; humans &amp; dogs 99% of the time/&gt;</name>"
                      , result, true);
        }
Esempio n. 9
0
        public virtual void TestBasicForCeRxWithMultipleNameParts()
        {
            EnR2PropertyFormatter formatter  = new EnR2PropertyFormatter();
            PersonName            personName = new PersonName();

            personName.AddUse(Ca.Infoway.Messagebuilder.Domainvalue.Basic.EntityNameUse.LEGAL);
            personName.AddNamePart(new EntityNamePart("Steve", PersonNamePartType.GIVEN));
            personName.AddNamePart(new EntityNamePart("Shaw", PersonNamePartType.FAMILY));
            string result = formatter.Format(GetContext("name", "PN", SpecificationVersion.V01R04_3), new PNImpl(personName));

            Assert.IsTrue(this.result.IsValid());
            AssertXml("something in text node", "<name use=\"L\"><given>Steve</given><family>Shaw</family></name>", result, true);
        }
Esempio n. 10
0
        public virtual void TestFormatValueNonNullWithQualifier()
        {
            EnR2PropertyFormatter formatter  = new EnR2PropertyFormatter();
            PersonName            personName = new PersonName();

            personName.AddUse(Ca.Infoway.Messagebuilder.Domainvalue.Basic.EntityNameUse.LEGAL);
            personName.AddNamePart(new EntityNamePart("Shaw", PersonNamePartType.FAMILY, Ca.Infoway.Messagebuilder.Domainvalue.Basic.EntityNamePartQualifier
                                                      .BIRTH));
            string result = formatter.Format(GetContext("name", "PN", SpecificationVersion.V02R02), new PNImpl(personName));

            Assert.IsTrue(this.result.IsValid());
            AssertXml("something in text node", "<name use=\"L\"><family qualifier=\"BR\">Shaw</family></name>", result, true);
        }
Esempio n. 11
0
        public virtual void TestFormatValueNonNullWithMultipleUses()
        {
            EnR2PropertyFormatter formatter  = new EnR2PropertyFormatter();
            PersonName            personName = new PersonName();

            personName.AddUse(Ca.Infoway.Messagebuilder.Domainvalue.Basic.EntityNameUse.LEGAL);
            personName.AddUse(Ca.Infoway.Messagebuilder.Domainvalue.Basic.EntityNameUse.PSEUDONYM);
            personName.AddNamePart(new EntityNamePart("Steve Shaw"));
            string result = formatter.Format(GetContext("name", "PN", SpecificationVersion.R02_04_02), new PNImpl(personName));

            Assert.IsTrue(this.result.IsValid());
            AssertXml("something in text node", "<name use=\"L P\">Steve Shaw</name>", result.Trim(), true);
        }
Esempio n. 12
0
        public virtual void TestFormatValueNonNullInvalidQualifer()
        {
            EnR2PropertyFormatter formatter   = new EnR2PropertyFormatter();
            TrivialName           trivialName = new TrivialName();

            trivialName.AddNamePart(new EntityNamePart("something", null, Ca.Infoway.Messagebuilder.Domainvalue.Basic.EntityNamePartQualifier
                                                       .INITIAL));
            string result = formatter.Format(GetContext("name", "TN"), new TNImpl(trivialName));

            Assert.IsFalse(this.result.IsValid());
            Assert.AreEqual(1, this.result.GetHl7Errors().Count);
            AssertXml("something in text node", "<name>something</name>", result, true);
        }
Esempio n. 13
0
        public virtual void TestFormatInvalidNameUses()
        {
            EnR2PropertyFormatter formatter = new EnR2PropertyFormatter();
            EntityName            name      = new TrivialName("something");

            name.AddUse(Ca.Infoway.Messagebuilder.Domainvalue.Basic.EntityNameUse.ALPHABETIC);
            name.AddUse(Ca.Infoway.Messagebuilder.Domainvalue.Basic.EntityNameUse.IDEOGRAPHIC);
            string result = formatter.Format(GetContext("name", "TN"), new ENImpl <EntityName>(name));

            Assert.IsFalse(this.result.IsValid());
            Assert.AreEqual(1, this.result.GetHl7Errors().Count);
            AssertXml("something in text node", "<name use=\"ABC IDE\">something</name>", result, true);
        }
Esempio n. 14
0
        public virtual void TestFormatValueReservedXmlChars()
        {
            EnR2PropertyFormatter formatter  = new EnR2PropertyFormatter();
            PersonName            personName = new PersonName();

            personName.AddUse(Ca.Infoway.Messagebuilder.Domainvalue.Basic.EntityNameUse.LEGAL);
            personName.AddNamePart(new EntityNamePart("<cats tk they're > humans & dogs 99% of the time/>"));
            string result = formatter.Format(GetContext("name", "PN", SpecificationVersion.R02_04_02), new PNImpl(personName));

            Assert.IsTrue(this.result.IsValid());
            AssertXml("something in text node", "<name use=\"L\">&lt;cats tk they&apos;re &gt; humans &amp; dogs 99% of the time/&gt;</name>"
                      , result, true);
        }
Esempio n. 15
0
        public virtual void TestFormatValueNonNullMultipleNameParts()
        {
            EnR2PropertyFormatter formatter        = new EnR2PropertyFormatter();
            OrganizationName      organizationName = new OrganizationName();

            organizationName.AddNamePart(new EntityNamePart("prefix", OrganizationNamePartType.PREFIX));
            organizationName.AddNamePart(new EntityNamePart("Organization"));
            organizationName.AddNamePart(new EntityNamePart(",", OrganizationNamePartType.DELIMITER));
            organizationName.AddNamePart(new EntityNamePart("Inc", OrganizationNamePartType.SUFFIX));
            string result = formatter.Format(GetContext("name", "ON"), new ONImpl(organizationName));

            Assert.IsTrue(this.result.IsValid());
            AssertXml("something in text node with goofy sub nodes", "<name><prefix>prefix</prefix>Organization<delimiter>,</delimiter><suffix>Inc</suffix></name>"
                      , result, true);
        }
Esempio n. 16
0
        public virtual void TestFormatValueNonNullWithValidTime()
        {
            PlatformDate            lowDate     = new DateWithPattern(DateUtil.GetDate(2006, 11, 25), "yyyyMMdd");
            PlatformDate            highDate    = new DateWithPattern(DateUtil.GetDate(2014, 3, 12), "yyyyMMdd");
            Interval <PlatformDate> validTime   = IntervalFactory.CreateLowHigh(lowDate, highDate);
            EnR2PropertyFormatter   formatter   = new EnR2PropertyFormatter();
            TrivialName             trivialName = new TrivialName("something");

            trivialName.ValidTime = validTime;
            string result = formatter.Format(GetContext("name", "TN"), new TNImpl(trivialName));

            Assert.IsTrue(this.result.IsValid());
            AssertXml("something in text node", "<name>something<validTime><low value=\"20061225\"/><high value=\"20140412\"/></validTime></name>"
                      , result, true);
        }
Esempio n. 17
0
        public virtual void TestFormatSimpleWithMoreThanOneSimplePart()
        {
            EnR2PropertyFormatter formatter  = new EnR2PropertyFormatter();
            PersonName            personName = new PersonName();

            personName.AddUse(Ca.Infoway.Messagebuilder.Domainvalue.Basic.EntityNameUse.LEGAL);
            personName.AddNamePart(new EntityNamePart("Steve"));
            personName.AddNamePart(new EntityNamePart("Shaw"));
            string result = formatter.Format(GetContext("name", "PN", SpecificationVersion.R02_04_02), new PNImpl(personName));

            Assert.IsTrue(this.result.IsValid());
            System.Console.Out.WriteLine(result);
            Assert.AreEqual("<name use=\"L\">" + SystemUtils.LINE_SEPARATOR + "  Steve" + SystemUtils.LINE_SEPARATOR + "  Shaw" + SystemUtils
                            .LINE_SEPARATOR + "</name>" + SystemUtils.LINE_SEPARATOR, result, "something in text node");
        }
Esempio n. 18
0
        public virtual void TestFormatSimpleWithTwoNonSimpleParts()
        {
            EnR2PropertyFormatter formatter  = new EnR2PropertyFormatter();
            PersonName            personName = new PersonName();

            personName.AddUse(Ca.Infoway.Messagebuilder.Domainvalue.Basic.EntityNameUse.LEGAL);
            personName.AddNamePart(new EntityNamePart("Steve", PersonNamePartType.GIVEN));
            personName.AddNamePart(new EntityNamePart("Shaw", PersonNamePartType.FAMILY));
            string result = formatter.Format(GetContext("name", "PN", SpecificationVersion.R02_04_02), new PNImpl(personName));

            Assert.IsTrue(this.result.IsValid());
            Assert.AreEqual("<name use=\"L\">" + SystemUtils.LINE_SEPARATOR + "  <given>Steve</given>" + SystemUtils.LINE_SEPARATOR +
                            "  <family>Shaw</family>" + SystemUtils.LINE_SEPARATOR + "</name>" + SystemUtils.LINE_SEPARATOR, result, "formatted text node"
                            );
            AssertXml("something in text node", "<name use=\"L\"><given>Steve</given><family>Shaw</family></name>", result, true);
        }
Esempio n. 19
0
        public virtual void TestFormatValueNonNullMultipleNameParts()
        {
            EnR2PropertyFormatter formatter  = new EnR2PropertyFormatter();
            PersonName            personName = new PersonName();

            personName.AddUse(Ca.Infoway.Messagebuilder.Domainvalue.Basic.EntityNameUse.LEGAL);
            personName.AddNamePart(new EntityNamePart("prefix", PersonNamePartType.PREFIX, Ca.Infoway.Messagebuilder.Domainvalue.Basic.EntityNamePartQualifier
                                                      .INITIAL));
            personName.AddNamePart(new EntityNamePart("given1", PersonNamePartType.GIVEN));
            personName.AddNamePart(new EntityNamePart("given2", PersonNamePartType.GIVEN));
            personName.AddNamePart(new EntityNamePart("given3", PersonNamePartType.GIVEN));
            personName.AddNamePart(new EntityNamePart("given4", PersonNamePartType.GIVEN));
            personName.AddNamePart(new EntityNamePart("family", PersonNamePartType.FAMILY));
            personName.AddNamePart(new EntityNamePart("suffix", PersonNamePartType.SUFFIX, Ca.Infoway.Messagebuilder.Domainvalue.Basic.EntityNamePartQualifier
                                                      .INITIAL));
            string result = formatter.Format(GetContext("name", "PN", SpecificationVersion.R02_04_02), new PNImpl(personName));

            Assert.IsTrue(this.result.IsValid());
            AssertXml("well formed name", "<name use=\"L\"><prefix qualifier=\"IN\">prefix</prefix><given>given1</given><given>given2</given><given>given3</given><given>given4</given><family>family</family><suffix qualifier=\"IN\">suffix</suffix></name>"
                      , result, true);
        }