本文整理汇总了C#中Validator.GetZipCode方法的典型用法代码示例。如果您正苦于以下问题:C# Validator.GetZipCode方法的具体用法?C# Validator.GetZipCode怎么用?C# Validator.GetZipCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Validator
的用法示例。
在下文中一共展示了Validator.GetZipCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
//.........这里部分代码省略.........
Console.WriteLine( item );
var validator = new Validator();
var vp = new ValidationErrorHandler( errorWriter );
Console.WriteLine( validator.GetUrl( vp, "hTTp://RedStapler.biZ/fRed", false ) );
Assert.IsFalse( vp.LastResult != ErrorCondition.NoError );
vp = new ValidationErrorHandler( errorWriter );
Console.WriteLine( validator.GetUrl( vp, "fred", true ) );
Assert.IsFalse( vp.LastResult == ErrorCondition.NoError );
vp = new ValidationErrorHandler( errorWriter );
Console.Write( validator.GetNullableSqlSmallDateTimeExact( vp, "fred", "MM/dd/yyy", false ) );
Assert.IsFalse( vp.LastResult == ErrorCondition.NoError );
vp = new ValidationErrorHandler( errorWriter );
Console.WriteLine( validator.GetInt( vp, "fred" ) );
Assert.IsFalse( vp.LastResult == ErrorCondition.NoError );
vp = new ValidationErrorHandler( errorWriter ); // "myGoodInt" );
Console.WriteLine( validator.GetInt( vp, "-342" ) );
Assert.IsFalse( vp.LastResult != ErrorCondition.NoError );
vp = new ValidationErrorHandler( errorWriter ); // "myBadDate" );
Console.WriteLine( validator.GetSqlSmallDateTimeFromParts( vp, "3", "", "" ) );
Assert.IsFalse( vp.LastResult == ErrorCondition.NoError );
vp = new ValidationErrorHandler( errorWriter ); // "myBadDate" );
Console.WriteLine( validator.GetSqlSmallDateTimeFromParts( vp, "", "", "" ) );
Assert.IsFalse( vp.LastResult == ErrorCondition.NoError );
vp = new ValidationErrorHandler( errorWriter ); // "zip" );
Console.WriteLine( validator.GetZipCode( vp, "14580", true ).FullZipCode );
Assert.IsFalse( vp.LastResult != ErrorCondition.NoError );
vp = new ValidationErrorHandler( errorWriter ); // "zip" );
Console.WriteLine( validator.GetZipCode( vp, "14580-1234", true ).FullZipCode );
Assert.IsFalse( vp.LastResult != ErrorCondition.NoError );
vp = new ValidationErrorHandler( errorWriter ); // "badZip" );
Console.WriteLine( validator.GetZipCode( vp, "123", false ).FullZipCode );
Assert.IsFalse( vp.LastResult == ErrorCondition.NoError );
Console.WriteLine( "---------------------------------\nPhone Numbers:\n------------------------------------\n" );
vp = new ValidationErrorHandler( errorWriter );
Console.WriteLine( validator.GetPhoneNumber( vp, "5854556476", true, true, false ) );
Assert.IsFalse( vp.LastResult != ErrorCondition.NoError );
vp = new ValidationErrorHandler( errorWriter );
Console.WriteLine( validator.GetPhoneNumber( vp, "585 4556476", true, true, false ) );
Assert.IsFalse( vp.LastResult != ErrorCondition.NoError );
vp = new ValidationErrorHandler( errorWriter );
Console.WriteLine( validator.GetPhoneNumber( vp, "( 585 )455-6476", true, true, false ) );
Assert.IsFalse( vp.LastResult != ErrorCondition.NoError );
vp = new ValidationErrorHandler( errorWriter );
Console.WriteLine( validator.GetPhoneNumber( vp, "(585)455-6476", true, true, false ) );
Assert.IsFalse( vp.LastResult != ErrorCondition.NoError );
vp = new ValidationErrorHandler( errorWriter );
Console.WriteLine( validator.GetPhoneNumber( vp, "585-455-6476", true, true, false ) );
Assert.IsFalse( vp.LastResult != ErrorCondition.NoError );
vp = new ValidationErrorHandler( errorWriter );