public void IsValidateEmailTest() { Assert.IsFalse(Extenstion.IsValidateEmail("11")); Assert.IsFalse(Extenstion.IsValidateEmail("1@1")); Assert.IsTrue(Extenstion.IsValidateEmail("*****@*****.**")); Assert.IsTrue(Extenstion.IsValidateEmail("*****@*****.**")); Assert.IsTrue(Extenstion.IsValidateEmail("*****@*****.**")); }
public void IsValidateNubmerTest() { Assert.IsFalse(Extenstion.IsValidateNubmer("1-")); Assert.IsTrue(Extenstion.IsValidateNubmer("123")); Assert.IsFalse(Extenstion.IsValidateNubmer("23;")); Assert.IsFalse(Extenstion.IsValidateNubmer("1.098")); Assert.IsFalse(Extenstion.IsValidateNubmer("0123")); }
public void IsValidateChineseTest() { Assert.IsFalse(Extenstion.IsValidateChinese("中a国")); Assert.IsTrue(Extenstion.IsValidateChinese("中国")); Assert.IsFalse(Extenstion.IsValidateChinese("中 国")); Assert.IsFalse(Extenstion.IsValidateChinese("中_国")); Assert.IsFalse(Extenstion.IsValidateChinese("中国 ")); }
public void IsValidateIntegerTest() { Assert.IsFalse(Extenstion.IsValidateInteger("11.1")); Assert.IsFalse(Extenstion.IsValidateInteger("1aa")); Assert.IsFalse(Extenstion.IsValidateInteger("0.99")); Assert.IsTrue(Extenstion.IsValidateInteger("123")); Assert.IsFalse(Extenstion.IsValidateInteger("09")); Assert.IsFalse(Extenstion.IsValidateInteger("-1123")); }
public void IsValidateUrlTest() { Assert.IsFalse(Extenstion.IsValidateUrl("http//ww.126.com")); Assert.IsTrue(Extenstion.IsValidateUrl("ftp://www.126.com")); Assert.IsFalse(Extenstion.IsValidateUrl("ftp//www.126.com")); Assert.IsTrue(Extenstion.IsValidateUrl("https://www.sina.com.cn")); Assert.IsTrue(Extenstion.IsValidateUrl("http://www.baidu.com")); Assert.IsTrue(Extenstion.IsValidateUrl("ftp://10.200.8.8")); }
public void IsValidateAlphaLowerTest() { Assert.IsFalse(Extenstion.IsValidateAlphaLower("asdfAASDF")); Assert.IsTrue(Extenstion.IsValidateAlphaLower("asdfasdf")); Assert.IsFalse(Extenstion.IsValidateAlphaLower("asdf123")); Assert.IsFalse(Extenstion.IsValidateAlphaLower("as df")); Assert.IsFalse(Extenstion.IsValidateAlphaLower("asdf_asdf")); Assert.IsFalse(Extenstion.IsValidateAlphaLower("sA1")); }
public void IsValidateAlphaUpperTest() { Assert.IsFalse(Extenstion.IsValidateAlphaUpper("asdfAASDF")); Assert.IsTrue(Extenstion.IsValidateAlphaUpper("ASDFKLJ")); Assert.IsFalse(Extenstion.IsValidateAlphaUpper("ASDFJ_ASD")); Assert.IsFalse(Extenstion.IsValidateAlphaUpper(" ASDF")); Assert.IsFalse(Extenstion.IsValidateAlphaUpper("12ASDF")); Assert.IsFalse(Extenstion.IsValidateAlphaUpper("ASDF,ASDF")); }
public void IsValidateAlphaAndNumberTest() { Assert.IsFalse(Extenstion.IsValidateAlphaAndNumber("!af&asldfj")); Assert.IsTrue(Extenstion.IsValidateAlphaAndNumber("123asdfAsdf123")); Assert.IsFalse(Extenstion.IsValidateAlphaAndNumber("123_2asd")); Assert.IsTrue(Extenstion.IsValidateAlphaAndNumber("123jkasdfasd123")); Assert.IsTrue(Extenstion.IsValidateAlphaAndNumber("asdfasdf")); Assert.IsTrue(Extenstion.IsValidateAlphaAndNumber("88123")); }
public void IsValidateMoneyTest() { Assert.IsFalse(Extenstion.IsValidateMoney("11.12312")); Assert.IsFalse(Extenstion.IsValidateMoney("-1.89")); Assert.IsFalse(Extenstion.IsValidateMoney("9.0000")); Assert.IsFalse(Extenstion.IsValidateMoney("0.6")); Assert.IsTrue(Extenstion.IsValidateMoney("0.68")); Assert.IsTrue(Extenstion.IsValidateMoney("8.88")); }
public void IsValidateIpAddressTest() { Assert.IsFalse(Extenstion.IsValidateIpAddress("11.1")); Assert.IsFalse(Extenstion.IsValidateIpAddress("11.90.280.128")); Assert.IsTrue(Extenstion.IsValidateIpAddress("89.89.0.01")); Assert.IsTrue(Extenstion.IsValidateIpAddress("10.99.35.130")); Assert.IsTrue(Extenstion.IsValidateIpAddress("127.0.0.1")); Assert.IsTrue(Extenstion.IsValidateIpAddress("192.168.0.1")); }
public void IsValidateMobilePhoneTest() { Assert.IsFalse(Extenstion.IsValidateMobilePhone("12345678901")); Assert.IsTrue(Extenstion.IsValidateMobilePhone("13512345678")); Assert.IsTrue(Extenstion.IsValidateMobilePhone("17012345678")); Assert.IsFalse(Extenstion.IsValidateMobilePhone("17198765432")); Assert.IsTrue(Extenstion.IsValidateMobilePhone("18987654321")); Assert.IsTrue(Extenstion.IsValidateMobilePhone("18587654321")); Assert.IsFalse(Extenstion.IsValidateMobilePhone("1901231238812")); }
public void IsValidateHomePhoneTest() { Assert.IsFalse(Extenstion.IsValidateHomePhone("010-123234234")); Assert.IsTrue(Extenstion.IsValidateHomePhone("010-67891234")); Assert.IsTrue(Extenstion.IsValidateHomePhone("01067891234")); Assert.IsFalse(Extenstion.IsValidateHomePhone("0792678912341")); Assert.IsTrue(Extenstion.IsValidateHomePhone("079267891234")); Assert.IsTrue(Extenstion.IsValidateHomePhone("0792-67891234")); Assert.IsTrue(Extenstion.IsValidateHomePhone("0106789123")); Assert.IsFalse(Extenstion.IsValidateHomePhone("010a123123")); Assert.IsFalse(Extenstion.IsValidateHomePhone("010a1231231")); }
public void CheckIdCardTest() { //18位身份证校验 Assert.AreEqual(("34052419800101001X").CheckIdCard(), EnumIdCardResult.Success); Assert.AreEqual(Extenstion.CheckIdCard("340524198001010013"), EnumIdCardResult.ErrorCard); Assert.AreEqual(Extenstion.CheckIdCard("340524198013010013"), EnumIdCardResult.ErrorBirthday); Assert.AreEqual(Extenstion.CheckIdCard("010524198001010013"), EnumIdCardResult.ErrorProvince); Assert.AreEqual(Extenstion.CheckIdCard("010524198001010a13"), EnumIdCardResult.ErrorString); //15位身份证校验 Assert.AreEqual(Extenstion.CheckIdCard("360521790717485"), EnumIdCardResult.Success); Assert.AreEqual(Extenstion.CheckIdCard("360521791717485"), EnumIdCardResult.ErrorBirthday); Assert.AreEqual(Extenstion.CheckIdCard("010521790717485"), EnumIdCardResult.ErrorProvince); Assert.AreEqual(Extenstion.CheckIdCard("36052179071748a"), EnumIdCardResult.ErrorString); Assert.AreEqual(Extenstion.CheckIdCard("36052179071748123123"), EnumIdCardResult.ErrorString); }