示例#1
0
        [TestMethod] public void testAlternateFormatsOmitsDescPatterns()
        {
            String xmlInput =
                "<territory countryCode=\"33\">" +
                "  <availableFormats>" +
                "    <numberFormat pattern=\"(1)(\\d{3})\">" +
                "      <leadingDigits>1</leadingDigits>" +
                "      <format>$1</format>" +
                "    </numberFormat>" +
                "  </availableFormats>" +
                "  <fixedLine><nationalNumberPattern>\\d{1}</nationalNumberPattern></fixedLine>" +
                "  <shortCode><nationalNumberPattern>\\d{2}</nationalNumberPattern></shortCode>" +
                "</territory>";
            XmlElement    territoryElement = parseXmlString(xmlInput);
            PhoneMetadata metadata         = BuildMetadataFromXml.loadCountryMetadata("FR", territoryElement,
                                                                                      false /* liteBuild */, false /* isShortNumberMetadata */,
                                                                                      true /* isAlternateFormatsMetadata */);

            Assert.AreEqual("(1)(\\d{3})", metadata.getNumberFormat(0).getPattern());
            Assert.AreEqual("1", metadata.getNumberFormat(0).getLeadingDigitsPattern(0));
            Assert.AreEqual("$1", metadata.getNumberFormat(0).getFormat());
            Assert.IsFalse(metadata.HasFixedLine());
            Assert.IsNull(metadata.getFixedLine());
            Assert.IsFalse(metadata.HasShortCode());
            Assert.IsNull(metadata.getShortCode());
        }
示例#2
0
        public void testShortNumberMetadataContainsData()
        {
            // We should have some data for France.
            PhoneMetadata franceShortNumberMetadata = MetadataManager.getShortNumberMetadataForRegion("FR");

            Assert.IsNotNull(franceShortNumberMetadata);
            Assert.IsTrue(franceShortNumberMetadata.HasShortCode());
        }