Example #1
0
 /// <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);
 }
Example #2
0
 public void IsUnknown_VreemdCultureInvariant_IsFalse()
 {
     Assert.IsFalse(Unknown.IsUnknown("Vreemd", CultureInfo.InvariantCulture));
 }
Example #3
0
 public void IsUnknown_NaoSabeCulturePt_IsTrue()
 {
     Assert.IsTrue(Unknown.IsUnknown("Não SABe", new CultureInfo("pt-PT")));
 }
Example #4
0
 public void IsUnknown_QuestionMarkCultureNull_IsTrue()
 {
     Assert.IsTrue(Unknown.IsUnknown("?", null));
 }
Example #5
0
 public void IsUnknown_QuestionMarkCultureNl_IsTrue()
 {
     Assert.IsTrue(Unknown.IsUnknown("?", new CultureInfo("nl-NL")));
 }
Example #6
0
 public void IsUnknown_StringEmpty_IsFalse()
 {
     Assert.IsFalse(Unknown.IsUnknown(string.Empty));
 }
Example #7
0
 public void IsUnknown_Null_IsFalse()
 {
     Assert.IsFalse(Unknown.IsUnknown(null));
 }