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