예제 #1
0
        public virtual void TestFormatValueNonNullMultipleAddressPartsWithUseablePeriods()
        {
            AdR2PropertyFormatter formatter     = new AdR2PropertyFormatter();
            PostalAddress         postalAddress = new PostalAddress();

            postalAddress.AddPostalAddressPart(new PostalAddressPart(PostalAddressPartType.CITY, "cityname"));
            postalAddress.AddPostalAddressPart(new PostalAddressPart("freeform"));
            postalAddress.AddPostalAddressPart(new PostalAddressPart(PostalAddressPartType.DELIMITER, ","));
            postalAddress.AddPostalAddressPart(new PostalAddressPart(PostalAddressPartType.STATE, "ON"));
            postalAddress.IsNotOrdered = true;
            postalAddress.AddUseablePeriod(new DateWithPattern(DateUtil.GetDate(2007, 2, 23), "yyyyMMdd"), SetOperator.PERIODIC_HULL);
            postalAddress.AddUseablePeriod(new DateWithPattern(DateUtil.GetDate(2009, 9, 17), "yyyyMMdd"), null);
            postalAddress.AddUseablePeriod(new DateWithPattern(DateUtil.GetDate(2014, 6, 8), "yyyyMMdd"), SetOperator.INCLUDE);
            string result = formatter.Format(GetContext("addr", "AD"), new ADImpl(postalAddress));

            Assert.IsTrue(this.result.IsValid());
            AssertXml("addr with useable periods", "<addr isNotOrdered=\"true\"><city>cityname</city>freeform<delimiter>,</delimiter><state>ON</state><useablePeriod operator=\"P\" value=\"20070323\"/><useablePeriod operator=\"I\" value=\"20091017\"/><useablePeriod operator=\"I\" value=\"20140708\"/></addr>"
                      , result, true);
        }