public void IsValid() { Assert.IsTrue(CepHelper.IsValid("13617540")); Assert.IsTrue(CepHelper.IsValid("01513000")); Assert.IsFalse(CepHelper.IsValid("a1513000")); Assert.IsFalse(CepHelper.IsValid("3617540")); Assert.IsFalse(CepHelper.IsValid("1513000")); }
/// <summary> /// Checks if a string value is a valid CEP representation /// </summary> /// <param name="value">a CEP string to be checked</param> /// <param name="punctuation">the punctuation setting to /// how validation must be handled</param> /// <returns>true if CEP string is valid; otherwise, false</returns> public static bool Validate(string value, CepPunctuation punctuation) { return(CepHelper.Validate(value, punctuation)); }
/// <summary> /// Checks if a string value is a valid CEP representation /// </summary> /// <param name="value">a CEP string to be checked</param> /// <returns>true if CEP string is valid; false otherwise</returns> public static bool Validate(string value) { return(CepHelper.Validate(value, CepPunctuation.Loose)); }
public void Format() { Assert.AreEqual("13.617-540", CepHelper.Format("13617540")); Assert.AreEqual("1361754", CepHelper.Format("1361754")); Assert.AreEqual("Lorem Ipsum", CepHelper.Format("Lorem Ipsum")); }