當前位置: 首頁>>代碼示例>>C#>>正文


C# AddressValidator.ShouldNotHaveValidationErrorFor方法代碼示例

本文整理匯總了C#中AddressValidator.ShouldNotHaveValidationErrorFor方法的典型用法代碼示例。如果您正苦於以下問題:C# AddressValidator.ShouldNotHaveValidationErrorFor方法的具體用法?C# AddressValidator.ShouldNotHaveValidationErrorFor怎麽用?C# AddressValidator.ShouldNotHaveValidationErrorFor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在AddressValidator的用法示例。


在下文中一共展示了AddressValidator.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 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

示例2: 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

示例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_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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: Should_not_have_error_when_streetaddress2_is_specified

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

            var model = new AddressModel();
            model.Address2 = "Street address 2";
            validator.ShouldNotHaveValidationErrorFor(x => x.Address2, model);
        }
開發者ID:nvolpe,項目名稱:raver,代碼行數:12,代碼來源:AddressValidatorTests.cs

示例10: Should_not_have_error_when_phone_is_specified

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

            var model = new AddressModel();
            model.PhoneNumber = "Phone";
            validator.ShouldNotHaveValidationErrorFor(x => x.PhoneNumber, model);
        }
開發者ID:emretiryaki,項目名稱:paymill-nopcommerce,代碼行數:12,代碼來源:AddressValidatorTests.cs

示例11: 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:emretiryaki,項目名稱:paymill-nopcommerce,代碼行數:9,代碼來源:AddressValidatorTests.cs

示例12: Should_not_have_error_when_company_is_specified

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

            var model = new AddressModel();
            model.Company = "Company";
            validator.ShouldNotHaveValidationErrorFor(x => x.Company, model);
        }
開發者ID:emretiryaki,項目名稱:paymill-nopcommerce,代碼行數:12,代碼來源:AddressValidatorTests.cs

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

            //required
            var validator = new AddressValidator(_localizationService,
                new AddressSettings()
                {
                    StreetAddressEnabled = true,
                    StreetAddressRequired = true
                });
            model.Address1 = null;
            validator.ShouldHaveValidationErrorFor(x => x.Address1, model);
            model.Address1 = "";
            validator.ShouldHaveValidationErrorFor(x => x.Address1, model);

            //not required
            validator = new AddressValidator(_localizationService,
                new AddressSettings()
                {
                    StreetAddressEnabled = true,
                    StreetAddressRequired = false
                });
            model.Address1 = null;
            validator.ShouldNotHaveValidationErrorFor(x => x.Address1, model);
            model.Address1 = "";
            validator.ShouldNotHaveValidationErrorFor(x => x.Address1, model);
        }
開發者ID:emretiryaki,項目名稱:paymill-nopcommerce,代碼行數:28,代碼來源:AddressValidatorTests.cs

示例14: 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


注:本文中的AddressValidator.ShouldNotHaveValidationErrorFor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。