/// <summary>Formats the postal code.</summary> /// <param name="postalcode"> /// The postal code. /// </param> /// <returns> /// A formatted string representing the postal code. /// </returns> /// <remarks> /// If the country supports formatting and if the postal code is valid /// for the country. /// </remarks> public string Format(string postalcode) { if (HasFormatting && IsValid(postalcode)) { return(FormattingSearchPattern.Replace(postalcode, FormattingReplacePattern)); } if (Unknown.IsUnknown(postalcode, CultureInfo.InvariantCulture)) { return("?"); } return(postalcode ?? string.Empty); }
public void IsUnknown_VreemdCultureInvariant_IsFalse() { Assert.IsFalse(Unknown.IsUnknown("Vreemd", CultureInfo.InvariantCulture)); }
public void IsUnknown_NaoSabeCulturePt_IsTrue() { Assert.IsTrue(Unknown.IsUnknown("Não SABe", new CultureInfo("pt-PT"))); }
public void IsUnknown_QuestionMarkCultureNull_IsTrue() { Assert.IsTrue(Unknown.IsUnknown("?", null)); }
public void IsUnknown_QuestionMarkCultureNl_IsTrue() { Assert.IsTrue(Unknown.IsUnknown("?", new CultureInfo("nl-NL"))); }
public void IsUnknown_StringEmpty_IsFalse() { Assert.IsFalse(Unknown.IsUnknown(string.Empty)); }
public void IsUnknown_Null_IsFalse() { Assert.IsFalse(Unknown.IsUnknown(null)); }