// Tests loadTerritoryTagMetadata(). [TestMethod] public void testLoadTerritoryTagMetadata() { String xmlInput = "<territory countryCode='33' leadingDigits='2' internationalPrefix='00'" + " preferredInternationalPrefix='0011' nationalPrefixForParsing='0'" + " nationalPrefixTransformRule='9$1'" + // nationalPrefix manually injected. " preferredExtnPrefix=' x' mainCountryForCode='true'" + " leadingZeroPossible='true' mobileNumberPortableRegion='true'>" + "</territory>"; XmlElement territoryElement = parseXmlString(xmlInput); PhoneMetadata.Builder phoneMetadata = BuildMetadataFromXml.loadTerritoryTagMetadata("33", territoryElement, "0"); Assert.AreEqual(33, phoneMetadata.getCountryCode()); Assert.AreEqual("2", phoneMetadata.getLeadingDigits()); Assert.AreEqual("00", phoneMetadata.getInternationalPrefix()); Assert.AreEqual("0011", phoneMetadata.getPreferredInternationalPrefix()); Assert.AreEqual("0", phoneMetadata.getNationalPrefixForParsing()); Assert.AreEqual("9$1", phoneMetadata.getNationalPrefixTransformRule()); Assert.AreEqual("0", phoneMetadata.getNationalPrefix()); Assert.AreEqual(" x", phoneMetadata.getPreferredExtnPrefix()); Assert.IsTrue(phoneMetadata.getMainCountryForCode()); Assert.IsTrue(phoneMetadata.isLeadingZeroPossible()); Assert.IsTrue(phoneMetadata.isMobileNumberPortableRegion()); }