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


C# AddressValidator類代碼示例

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


AddressValidator類屬於命名空間,在下文中一共展示了AddressValidator類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


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