• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# AddressValidator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中AddressValidator的典型用法代码示例。如果您正苦于以下问题:C# AddressValidator类的具体用法?C# AddressValidator怎么用?C# AddressValidator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AddressValidator类属于命名空间,在下文中一共展示了AddressValidator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ImporterValidatorTests

 public ImporterValidatorTests()
 {
     var countryRepository = A.Fake<Domain.ICountryRepository>();
     var addressValidator = new AddressValidator(countryRepository);
     var contactValidator = new ContactValidator();
     validator = new ImporterValidator(addressValidator, contactValidator);
 }
开发者ID:EnvironmentAgency,项目名称:prsd-iws,代码行数:7,代码来源:ImporterValidatorTests.cs


示例2: Should_have_error_when_company_is_null_or_empty_based_on_required_setting

        public void Should_have_error_when_company_is_null_or_empty_based_on_required_setting()
        {
            var model = new AddressModel();

            //required
            var validator = new AddressValidator(_localizationService,
                new AddressSettings()
                {
                    CompanyEnabled = true,
                    CompanyRequired = true
                });
            model.Company = null;
            validator.ShouldHaveValidationErrorFor(x => x.Company, model);
            model.Company = "";
            validator.ShouldHaveValidationErrorFor(x => x.Company, model);

            //not required
            validator = new AddressValidator(_localizationService,
                new AddressSettings()
                {
                    CompanyEnabled = true,
                    CompanyRequired = false
                });
            model.Company = null;
            validator.ShouldNotHaveValidationErrorFor(x => x.Company, model);
            model.Company = "";
            validator.ShouldNotHaveValidationErrorFor(x => x.Company, model);
        }
开发者ID:emretiryaki,项目名称:paymill-nopcommerce,代码行数:28,代码来源:AddressValidatorTests.cs


示例3: Should_not_have_error_when_email_is_correct_format

        public void Should_not_have_error_when_email_is_correct_format()
        {
            var validator = new AddressValidator(_localizationService, _stateProvinceService,
                new AddressSettings());

            var model = new AddressModel();
            model.Email = "[email protected]";
            validator.ShouldNotHaveValidationErrorFor(x => x.Email, model);
        }
开发者ID:nvolpe,项目名称:raver,代码行数:9,代码来源:AddressValidatorTests.cs


示例4: Should_not_have_error_when_firstName_is_specified

        public void Should_not_have_error_when_firstName_is_specified()
        {
            var validator = new AddressValidator(_localizationService, _stateProvinceService,
                new AddressSettings());

            var model = new AddressModel();
            model.FirstName = "John";
            validator.ShouldNotHaveValidationErrorFor(x => x.FirstName, model);
        }
开发者ID:nvolpe,项目名称:raver,代码行数:9,代码来源:AddressValidatorTests.cs


示例5: Should_not_have_error_when_lastName_is_specified

        public void Should_not_have_error_when_lastName_is_specified()
        {
            var validator = new AddressValidator(_localizationService,
                new AddressSettings());

            var model = new AddressModel();
            model.LastName = "Smith";
            validator.ShouldNotHaveValidationErrorFor(x => x.LastName, model);
        }
开发者ID:JeffersonNascimento,项目名称:SmartStoreNET,代码行数:9,代码来源:AddressValidatorTests.cs


示例6: Should_have_error_when_email_is_wrong_format

        public void Should_have_error_when_email_is_wrong_format()
        {
            var validator = new AddressValidator(_localizationService,
                new AddressSettings());

            var model = new AddressModel();
            model.Email = "adminexample.com";
            validator.ShouldHaveValidationErrorFor(x => x.Email, model);
        }
开发者ID:JeffersonNascimento,项目名称:SmartStoreNET,代码行数:9,代码来源:AddressValidatorTests.cs


示例7: Should_have_error_when_lastName_is_null_or_empty

        public void Should_have_error_when_lastName_is_null_or_empty()
        {
            var validator = new AddressValidator(_localizationService, _stateProvinceService,
                new AddressSettings());

            var model = new AddressModel();
            model.LastName = null;
            validator.ShouldHaveValidationErrorFor(x => x.LastName, model);
            model.LastName = "";
            validator.ShouldHaveValidationErrorFor(x => x.LastName, model);
        }
开发者ID:nvolpe,项目名称:raver,代码行数:11,代码来源:AddressValidatorTests.cs


示例8: Should_have_error_when_email_is_null_or_empty

        public void Should_have_error_when_email_is_null_or_empty()
        {
            var validator = new AddressValidator(_localizationService,
                new AddressSettings());

            var model = new AddressModel();
            model.Email = null;
            validator.ShouldHaveValidationErrorFor(x => x.Email, model);
            model.Email = "";
            validator.ShouldHaveValidationErrorFor(x => x.Email, model);
        }
开发者ID:emretiryaki,项目名称:paymill-nopcommerce,代码行数:11,代码来源:AddressValidatorTests.cs


示例9: ReturnCandidateList

        public void ReturnCandidateList()
        {
            // Arrange
            var addressValidator = new AddressValidator(this.apiUrl, this.authId, this.authToken);
            var addressToValidate = new Address { Street = "315 Bowery", City = "New York", State = "NY", Zip = string.Empty };

            // Act
            List<CandidateAddress> candidateAddresses = addressValidator.Validate(addressToValidate);

            // Assert
            Assert.That(candidateAddresses.Count > 0);
        }
开发者ID:hohashi,项目名称:Hohashi.AddressValidator,代码行数:12,代码来源:TestAddress.cs


示例10: ImportNotificationValidatorTests

 public ImportNotificationValidatorTests()
 {
     var countryRepository = A.Fake<Domain.ICountryRepository>();
     var addressValidator = new AddressValidator(countryRepository);
     var contactValidator = A.Fake<ContactValidator>();
     var exporterValidator = new ExporterValidator(addressValidator, contactValidator);
     var facilityValidator = A.Fake<FacilityValidator>();
     var facilitiesValidator = new FacilityCollectionValidator(facilityValidator);
     var importerValidator = new ImporterValidator(addressValidator, contactValidator);
     var importRepository = A.Fake<Domain.ImportNotification.IImportNotificationRepository>();
     var preconsentedValidator = new PreconsentedValidator(importRepository);
     var producerValidator = new ProducerValidator(addressValidator, contactValidator);
     var draftImportRepository = A.Fake<DataAccess.Draft.IDraftImportNotificationRepository>();
     var shipmentValidator = new ShipmentValidator(draftImportRepository);
     var entryOrExitPointRepository = A.Fake<Domain.TransportRoute.IEntryOrExitPointRepository>();
     var competentAuthorityRepository = A.Fake<Domain.ICompetentAuthorityRepository>();
     var stateOfExportValidator = new StateOfExportValidator(entryOrExitPointRepository, competentAuthorityRepository);
     var stateOfImportValidator = new StateOfImportValidator(countryRepository, competentAuthorityRepository, entryOrExitPointRepository);
     var transitStateValidator = new TransitStateValidator(entryOrExitPointRepository, competentAuthorityRepository);
     var transitStatesValidator = new TransitStateCollectionValidator(transitStateValidator);
     var wasteOperationValidator = new WasteOperationValidator();
     var wasteTypeValidator = new WasteTypeValidator();
     var chemicalCompositionValidator = new ChemicalCompositionValidator();
     validator = new ImportNotificationValidator(exporterValidator,
         facilitiesValidator,
         importerValidator,
         preconsentedValidator,
         producerValidator,
         shipmentValidator,
         stateOfExportValidator,
         stateOfImportValidator,
         transitStatesValidator,
         wasteOperationValidator,
         wasteTypeValidator,
         chemicalCompositionValidator);
 }
开发者ID:EnvironmentAgency,项目名称:prsd-iws,代码行数:36,代码来源:ImportNotificationValidatorTests.cs


示例11: Setup

 public new void Setup()
 {
     _validator = new AddressValidator(_localizationService);
 }
开发者ID:philipengland,项目名称:albionextrusions.co.uk,代码行数:4,代码来源:AddressValidatorTests.cs


示例12: AddressValidatorFacts

 public AddressValidatorFacts()
 {
     _addressValidator = new AddressValidator();    
 }
开发者ID:FeodorFitsner,项目名称:OpenRealEstate.NET,代码行数:4,代码来源:AddressValidatorFacts.cs


示例13: SetUp

 public void SetUp()
 {
     sanFrancisco = AddressMother.SanFrancisco(ConstituentMother.ConstituentWithName(ConstituentNameMother.JamesFranklin()));
     validator = new AddressValidator();
 }
开发者ID:Kallivayalil,项目名称:KallivayalilNew,代码行数:5,代码来源:AddressValidatorTest.cs


示例14: Validate_AddressWithNoPostcode_GeneratesListOfErrors

 public void Validate_AddressWithNoPostcode_GeneratesListOfErrors()
 {
     var address = new Address();
     var result = new AddressValidator().Validate(address);
     Assert.That(result.Errors.Count, Is.EqualTo(1));
 }
开发者ID:RussPAll,项目名称:FluentJValidation-JQuery,代码行数:6,代码来源:AddressTest.cs


示例15: Should_not_have_error_when_fax_is_specified

        public void Should_not_have_error_when_fax_is_specified()
        {
            var validator = new AddressValidator(_localizationService, _stateProvinceService,
                new AddressSettings
                {
                    FaxEnabled = true
                });

            var model = new AddressModel();
            model.FaxNumber = "Fax";
            validator.ShouldNotHaveValidationErrorFor(x => x.FaxNumber, model);
        }
开发者ID:nvolpe,项目名称:raver,代码行数:12,代码来源:AddressValidatorTests.cs


示例16: Should_have_error_when_phone_is_null_or_empty_based_on_required_setting

        public void Should_have_error_when_phone_is_null_or_empty_based_on_required_setting()
        {
            var model = new AddressModel();

            //required
            var validator = new AddressValidator(_localizationService,
                new AddressSettings()
                {
                    PhoneEnabled = true,
                    PhoneRequired = true
                });
            model.PhoneNumber = null;
            validator.ShouldHaveValidationErrorFor(x => x.PhoneNumber, model);
            model.PhoneNumber = "";
            validator.ShouldHaveValidationErrorFor(x => x.PhoneNumber, model);

            //not required
            validator = new AddressValidator(_localizationService,
                new AddressSettings()
                {
                    PhoneEnabled = true,
                    PhoneRequired = false
                });
            model.PhoneNumber = null;
            validator.ShouldNotHaveValidationErrorFor(x => x.PhoneNumber, model);
            model.PhoneNumber = "";
            validator.ShouldNotHaveValidationErrorFor(x => x.PhoneNumber, model);
        }
开发者ID:emretiryaki,项目名称:paymill-nopcommerce,代码行数:28,代码来源:AddressValidatorTests.cs


示例17: Should_not_have_error_when_city_is_specified

        public void Should_not_have_error_when_city_is_specified()
        {
            var validator = new AddressValidator(_localizationService, _stateProvinceService,
                new AddressSettings
                {
                    CityEnabled = true
                });

            var model = new AddressModel();
            model.City = "City";
            validator.ShouldNotHaveValidationErrorFor(x => x.City, model);
        }
开发者ID:nvolpe,项目名称:raver,代码行数:12,代码来源:AddressValidatorTests.cs


示例18: Should_have_error_when_fax_is_null_or_empty_based_on_required_setting

        public void Should_have_error_when_fax_is_null_or_empty_based_on_required_setting()
        {
            var model = new AddressModel();

            //required
            var validator = new AddressValidator(_localizationService, _stateProvinceService,
                new AddressSettings
                {
                    FaxEnabled = true,
                    FaxRequired = true
                });
            model.FaxNumber = null;
            validator.ShouldHaveValidationErrorFor(x => x.FaxNumber, model);
            model.FaxNumber = "";
            validator.ShouldHaveValidationErrorFor(x => x.FaxNumber, model);


            //not required
            validator = new AddressValidator(_localizationService, _stateProvinceService,
                new AddressSettings
                {
                    FaxEnabled = true,
                    FaxRequired = false
                });
            model.FaxNumber = null;
            validator.ShouldNotHaveValidationErrorFor(x => x.FaxNumber, model);
            model.FaxNumber = "";
            validator.ShouldNotHaveValidationErrorFor(x => x.FaxNumber, model);
        }
开发者ID:nvolpe,项目名称:raver,代码行数:29,代码来源:AddressValidatorTests.cs


示例19: Should_have_error_when_zippostalcode_is_null_or_empty_based_on_required_setting

        public void Should_have_error_when_zippostalcode_is_null_or_empty_based_on_required_setting()
        {
            var model = new AddressModel();

            //required
            var validator = new AddressValidator(_localizationService, _stateProvinceService,
                new AddressSettings
                {
                    ZipPostalCodeEnabled = true,
                    ZipPostalCodeRequired = true
                });
            model.ZipPostalCode = null;
            validator.ShouldHaveValidationErrorFor(x => x.ZipPostalCode, model);
            model.ZipPostalCode = "";
            validator.ShouldHaveValidationErrorFor(x => x.ZipPostalCode, model);


            //not required
            validator = new AddressValidator(_localizationService, _stateProvinceService,
                new AddressSettings
                {
                    ZipPostalCodeEnabled = true,
                    ZipPostalCodeRequired = false
                });
            model.ZipPostalCode = null;
            validator.ShouldNotHaveValidationErrorFor(x => x.ZipPostalCode, model);
            model.ZipPostalCode = "";
            validator.ShouldNotHaveValidationErrorFor(x => x.ZipPostalCode, model);
        }
开发者ID:nvolpe,项目名称:raver,代码行数:29,代码来源:AddressValidatorTests.cs


示例20: Should_not_have_error_when_zippostalcode_is_specified

        public void Should_not_have_error_when_zippostalcode_is_specified()
        {
            var validator = new AddressValidator(_localizationService, _stateProvinceService,
                new AddressSettings
                {
                    StreetAddress2Enabled = true
                });

            var model = new AddressModel();
            model.ZipPostalCode = "zip";
            validator.ShouldNotHaveValidationErrorFor(x => x.ZipPostalCode, model);
        }
开发者ID:nvolpe,项目名称:raver,代码行数:12,代码来源:AddressValidatorTests.cs



注:本文中的AddressValidator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# AdhocWorkspace类代码示例发布时间:2022-05-24
下一篇:
C# AddressType类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap