Example #1
0
        public virtual void TestFormatValueNonNull()
        {
            OnPropertyFormatter formatter        = new OnPropertyFormatter();
            OrganizationName    organizationName = new OrganizationName();

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

            Assert.AreEqual("<name>Organization</name>", result.Trim(), "something in text node");
        }
Example #2
0
        public virtual void TestFormatValueReservedXmlChars()
        {
            OnPropertyFormatter formatter        = new OnPropertyFormatter();
            OrganizationName    organizationName = new OrganizationName();

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

            Assert.AreEqual("<name>&lt;cats think they&apos;re &gt; humans &amp; dogs 99% of the time/&gt;</name>".Trim(), result.Trim
                                (), "something in text node");
        }
Example #3
0
        public virtual void TestFormatValueNonNullMultipleNameParts()
        {
            OnPropertyFormatter formatter        = new OnPropertyFormatter();
            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"), new ONImpl(organizationName));

            Assert.AreEqual("<name><prefix>prefix</prefix>Organization<delimiter>,</delimiter><suffix>Inc</suffix></name>", result.Trim
                                (), "something in text node with goofy sub nodes");
        }
Example #4
0
        public virtual void TestFormatValueNull()
        {
            string result = new OnPropertyFormatter().Format(GetContext("name"), new ONImpl(null));

            Assert.AreEqual("<name nullFlavor=\"NI\"/>", result.Trim(), "named null format");
        }