当前位置: 首页>>代码示例>>C#>>正文


C# CustomerInfoValidator.ShouldNotHaveValidationErrorFor方法代码示例

本文整理汇总了C#中CustomerInfoValidator.ShouldNotHaveValidationErrorFor方法的典型用法代码示例。如果您正苦于以下问题:C# CustomerInfoValidator.ShouldNotHaveValidationErrorFor方法的具体用法?C# CustomerInfoValidator.ShouldNotHaveValidationErrorFor怎么用?C# CustomerInfoValidator.ShouldNotHaveValidationErrorFor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CustomerInfoValidator的用法示例。


在下文中一共展示了CustomerInfoValidator.ShouldNotHaveValidationErrorFor方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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 CustomerInfoModel();

            //required
            var validator = new CustomerInfoValidator(_localizationService,
                new CustomerSettings()
                {
                    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 CustomerInfoValidator(_localizationService,
                new CustomerSettings()
                {
                    CompanyEnabled = true,
                    CompanyRequired = false
                });
            model.Company = null;
            validator.ShouldNotHaveValidationErrorFor(x => x.Company, model);
            model.Company = "";
            validator.ShouldNotHaveValidationErrorFor(x => x.Company, model);
        }
开发者ID:vic0626,项目名称:nas-merk,代码行数:28,代码来源:CustomerInfoValidatorTests.cs

示例2: Should_not_have_error_when_firstName_is_specified

        public void Should_not_have_error_when_firstName_is_specified()
        {
            var validator = new CustomerInfoValidator(_localizationService, 
                new CustomerSettings());

            var model = new CustomerInfoModel();
            model.FirstName = "John";
            validator.ShouldNotHaveValidationErrorFor(x => x.FirstName, model);
        }
开发者ID:haithemChkel,项目名称:nopCommerce_33,代码行数:9,代码来源:CustomerInfoValidatorTests.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 CustomerInfoValidator(_localizationService,
                new CustomerSettings());

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

示例4: Should_not_have_error_when_zippostalcode_is_specified

        public void Should_not_have_error_when_zippostalcode_is_specified()
        {
            var validator = new CustomerInfoValidator(_localizationService,
                new CustomerSettings()
                {
                    StreetAddress2Enabled = true
                });

            var model = new CustomerInfoModel();
            model.ZipPostalCode = "zip";
            validator.ShouldNotHaveValidationErrorFor(x => x.ZipPostalCode, model);
        }
开发者ID:vic0626,项目名称:nas-merk,代码行数:12,代码来源:CustomerInfoValidatorTests.cs

示例5: Should_not_have_error_when_streetaddress_is_specified

        public void Should_not_have_error_when_streetaddress_is_specified()
        {
            var validator = new CustomerInfoValidator(_localizationService,
                new CustomerSettings()
                {
                    StreetAddressEnabled = true
                });

            var model = new CustomerInfoModel();
            model.StreetAddress = "Street address";
            validator.ShouldNotHaveValidationErrorFor(x => x.StreetAddress, model);
        }
开发者ID:vic0626,项目名称:nas-merk,代码行数:12,代码来源:CustomerInfoValidatorTests.cs

示例6: Should_not_have_error_when_phone_is_specified

        public void Should_not_have_error_when_phone_is_specified()
        {
            var validator = new CustomerInfoValidator(_localizationService,
                new CustomerSettings()
                {
                    PhoneEnabled = true
                });

            var model = new CustomerInfoModel();
            model.Phone = "Phone";
            validator.ShouldNotHaveValidationErrorFor(x => x.Phone, model);
        }
开发者ID:vic0626,项目名称:nas-merk,代码行数:12,代码来源:CustomerInfoValidatorTests.cs

示例7: Should_not_have_error_when_fax_is_specified

        public void Should_not_have_error_when_fax_is_specified()
        {
            var validator = new CustomerInfoValidator(_localizationService,
                new CustomerSettings()
                {
                    FaxEnabled = true
                });

            var model = new CustomerInfoModel();
            model.Fax = "Fax";
            validator.ShouldNotHaveValidationErrorFor(x => x.Fax, model);
        }
开发者ID:vic0626,项目名称:nas-merk,代码行数:12,代码来源:CustomerInfoValidatorTests.cs

示例8: Should_not_have_error_when_company_is_specified

        public void Should_not_have_error_when_company_is_specified()
        {
            var validator = new CustomerInfoValidator(_localizationService,
                new CustomerSettings()
                {
                    CompanyEnabled = true
                });

            var model = new CustomerInfoModel();
            model.Company = "Company";
            validator.ShouldNotHaveValidationErrorFor(x => x.Company, model);
        }
开发者ID:vic0626,项目名称:nas-merk,代码行数:12,代码来源:CustomerInfoValidatorTests.cs

示例9: 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 CustomerInfoModel();

            //required
            var validator = new CustomerInfoValidator(_localizationService,
                new CustomerSettings()
                {
                    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 CustomerInfoValidator(_localizationService,
                new CustomerSettings()
                {
                    ZipPostalCodeEnabled = true,
                    ZipPostalCodeRequired = false
                });
            model.ZipPostalCode = null;
            validator.ShouldNotHaveValidationErrorFor(x => x.ZipPostalCode, model);
            model.ZipPostalCode = "";
            validator.ShouldNotHaveValidationErrorFor(x => x.ZipPostalCode, model);
        }
开发者ID:vic0626,项目名称:nas-merk,代码行数:28,代码来源:CustomerInfoValidatorTests.cs

示例10: Should_have_error_when_streetaddress_is_null_or_empty_based_on_required_setting

        public void Should_have_error_when_streetaddress_is_null_or_empty_based_on_required_setting()
        {
            var model = new CustomerInfoModel();

            //required
            var validator = new CustomerInfoValidator(_localizationService,
                new CustomerSettings()
                {
                    StreetAddressEnabled = true,
                    StreetAddressRequired = true
                });
            model.StreetAddress = null;
            validator.ShouldHaveValidationErrorFor(x => x.StreetAddress, model);
            model.StreetAddress = "";
            validator.ShouldHaveValidationErrorFor(x => x.StreetAddress, model);

            //not required
            validator = new CustomerInfoValidator(_localizationService,
                new CustomerSettings()
                {
                    StreetAddressEnabled = true,
                    StreetAddressRequired = false
                });
            model.StreetAddress = null;
            validator.ShouldNotHaveValidationErrorFor(x => x.StreetAddress, model);
            model.StreetAddress = "";
            validator.ShouldNotHaveValidationErrorFor(x => x.StreetAddress, model);
        }
开发者ID:vic0626,项目名称:nas-merk,代码行数:28,代码来源:CustomerInfoValidatorTests.cs

示例11: Should_not_have_error_when_lastName_is_specified

        public void Should_not_have_error_when_lastName_is_specified()
        {
            var validator = new CustomerInfoValidator(_localizationService, _stateProvinceService,
                new CustomerSettings());

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

示例12: Should_not_have_error_when_city_is_specified

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

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

示例13: 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 CustomerInfoModel();

            //required
            var validator = new CustomerInfoValidator(_localizationService, _stateProvinceService,
                new CustomerSettings
                {
                    PhoneEnabled = true,
                    PhoneRequired = true
                });
            model.Phone = null;
            validator.ShouldHaveValidationErrorFor(x => x.Phone, model);
            model.Phone = "";
            validator.ShouldHaveValidationErrorFor(x => x.Phone, model);

            //not required
            validator = new CustomerInfoValidator(_localizationService, _stateProvinceService,
                new CustomerSettings
                {
                    PhoneEnabled = true,
                    PhoneRequired = false
                });
            model.Phone = null;
            validator.ShouldNotHaveValidationErrorFor(x => x.Phone, model);
            model.Phone = "";
            validator.ShouldNotHaveValidationErrorFor(x => x.Phone, model);
        }
开发者ID:Cyric297,项目名称:nopCommerce,代码行数:28,代码来源:CustomerInfoValidatorTests.cs

示例14: 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 customerSettings = new CustomerSettings()
            {
                FaxEnabled = true
            };
            var validator = new CustomerInfoValidator(_localizationService, customerSettings);

            var model = new CustomerInfoModel();
            //required
            customerSettings.FaxRequired = true;
            model.Fax = null;
            validator.ShouldHaveValidationErrorFor(x => x.Fax, model);
            model.Fax = "";
            validator.ShouldHaveValidationErrorFor(x => x.Fax, model);
            //not required
            customerSettings.FaxRequired = false;
            model.Fax = null;
            validator.ShouldNotHaveValidationErrorFor(x => x.Fax, model);
            model.Fax = "";
            validator.ShouldNotHaveValidationErrorFor(x => x.Fax, model);
        }
开发者ID:philipengland,项目名称:albionextrusions.co.uk,代码行数:22,代码来源:CustomerInfoValidatorTests.cs


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