public void TestForSpecialBuild() { var blacklist = new Dictionary <string, SortedSet <string> > { { "fixedLine", new SortedSet <string>(MetadataFilter.ExcludableChildFields) }, { "tollFree", new SortedSet <string>(MetadataFilter.ExcludableChildFields) }, { "premiumRate", new SortedSet <string>(MetadataFilter.ExcludableChildFields) }, { "sharedCost", new SortedSet <string>(MetadataFilter.ExcludableChildFields) }, { "personalNumber", new SortedSet <string>(MetadataFilter.ExcludableChildFields) }, { "voip", new SortedSet <string>(MetadataFilter.ExcludableChildFields) }, { "pager", new SortedSet <string>(MetadataFilter.ExcludableChildFields) }, { "uan", new SortedSet <string>(MetadataFilter.ExcludableChildFields) }, { "emergency", new SortedSet <string>(MetadataFilter.ExcludableChildFields) }, { "voicemail", new SortedSet <string>(MetadataFilter.ExcludableChildFields) }, { "shortCode", new SortedSet <string>(MetadataFilter.ExcludableChildFields) }, { "standardRate", new SortedSet <string>(MetadataFilter.ExcludableChildFields) }, { "carrierSpecific", new SortedSet <string>(MetadataFilter.ExcludableChildFields) }, { "smsServices", new SortedSet <string>(MetadataFilter.ExcludableChildFields) }, { "noInternationalDialling", new SortedSet <string>(MetadataFilter.ExcludableChildFields) }, { "preferredInternationalPrefix", new SortedSet <string>() }, { "nationalPrefix", new SortedSet <string>() }, { "preferredExtnPrefix", new SortedSet <string>() }, { "nationalPrefixTransformRule", new SortedSet <string>() }, { "sameMobileAndFixedLinePattern", new SortedSet <string>() }, { "mainCountryForCode", new SortedSet <string>() }, { "leadingZeroPossible", new SortedSet <string>() }, { "mobileNumberPortableRegion", new SortedSet <string>() } }; Assert.Equal(MetadataFilter.ForSpecialBuild(), new MetadataFilter(blacklist)); }
public void TestFilterMetadata_SpecialBuild() { var metadata = FakeArmeniaPhoneMetadata(); MetadataFilter.ForSpecialBuild().FilterMetadata(metadata); // id, country_code, and international_prefix should never be cleared. Assert.Equal(metadata.Id, ID); Assert.Equal(metadata.CountryCode, COUNTRY_CODE); Assert.Equal(metadata.InternationalPrefix, INTERNATIONAL_PREFIX); // preferred_international_prefix should be cleared in specialBuild. Assert.False(metadata.HasPreferredInternationalPrefix); // general_desc should have all fields but example_number; mobile should have all fields. foreach (var desc in new List <PhoneNumberDesc> { metadata.GeneralDesc, metadata.Mobile }) { Assert.Equal(desc.NationalNumberPattern, NATIONAL_NUMBER_PATTERN); Assert.True(ContentsEqual(desc.PossibleLengthList.ToList(), PossibleLengths)); Assert.True(ContentsEqual(desc.PossibleLengthLocalOnlyList.ToList(), PossibleLengthsLocalOnly)); } Assert.False(metadata.GeneralDesc.HasExampleNumber); Assert.Equal(metadata.Mobile.ExampleNumber, EXAMPLE_NUMBER); // All other PhoneNumberDescs must have all fields cleared. foreach (var desc in new List <PhoneNumberDesc> { metadata.FixedLine, metadata.TollFree }) { Assert.False(desc.HasNationalNumberPattern); Assert.Equal(0, desc.PossibleLengthList.Count); Assert.Equal(0, desc.PossibleLengthLocalOnlyList.Count); Assert.False(desc.HasExampleNumber); } }