public DocumentSaver(IAuthorizationService authorizationService, AbstractValidator<Document> validator, IDocumentRepository documentRepository) { _authorizationService = authorizationService; _validator = validator; _documentRepository = documentRepository; }
public IdentifiersViewModel(IdentifiersModel model, AbstractValidator<IdentifiersModel> validator) { if (model == null) throw new ArgumentNullException("model"); if (validator == null) throw new ArgumentNullException("validator"); _model = model; _validator = validator; }
public LoginModelValidatorTests() { validator = new LoginValidator(); model = new LoginModel() { UserName = "******", Password = "******" }; }
protected override void Context() { base.Context(); AuthorizationService = MockRepository.GenerateStub<IAuthorizationService>(); Validator = MockRepository.GenerateStub<AbstractValidator<Document>>(); DocumentRepository = MockRepository.GenerateStub<IDocumentRepository>(); MappingEngine = MockRepository.GenerateStub<IMappingEngine>(); DocumentSaver = new DocumentSaver(AuthorizationService, Validator, DocumentRepository); }
public UserViewModel(UserModel model, AbstractValidator<IUserModel> validator) { if (model == null) throw new ArgumentNullException("model"); if (validator == null) throw new ArgumentNullException("validator"); _validator = validator; _data = model; _backup = model.Clone() as UserModel; OkCommand = new RelayCommand(OkCommandExecute); CancelCommand = new RelayCommand(CancelCommandExecute); }
public static RegistrationService GetRegistrationService( AbstractValidator<Registration> validator = null, IUserAuthRepository authRepo=null) { var requestContext = new MockRequestContext(); var service = new RegistrationService { RegistrationValidator = validator ?? new RegistrationValidator { UserAuthRepo = GetStubRepo() }, UserAuthRepo = authRepo ?? GetStubRepo(), RequestContext = requestContext }; return service; }
public static RegistrationService GetRegistrationService( AbstractValidator<Registration> validator = null, IUserAuthRepository authRepo=null) { var requestContext = new MockRequestContext(); var userAuthRepository = authRepo ?? GetStubRepo(); var service = new RegistrationService { RegistrationValidator = validator ?? new RegistrationValidator { UserAuthRepo = userAuthRepository }, UserAuthRepo = userAuthRepository, RequestContext = requestContext, }; var appHost = GetAppHost(); appHost.Register(userAuthRepository); service.SetAppHost(appHost); return service; }
public static RegisterService GetRegistrationService( AbstractValidator<Register> validator = null, IUserAuthRepository authRepo = null, string contentType = null) { var requestContext = new MockRequestContext(); if (contentType != null) { requestContext.ResponseContentType = contentType; } var userAuthRepository = authRepo ?? GetStubRepo(); var service = new RegisterService { RegistrationValidator = validator ?? new RegistrationValidator { UserAuthRepo = userAuthRepository }, AuthRepo = userAuthRepository, RequestContext = requestContext, }; HostContext.Container.Register(userAuthRepository); return service; }
internal static void AddCommonRules(this AbstractValidator <TraineeshipApplicationViewModel> validator) { validator.RuleFor(x => x.Notes) .Matches(ApplicationViewModelMessages.Notes.WhiteListRegularExpression) .WithMessage(ApplicationViewModelMessages.Notes.WhiteListErrorText); }
public static void ShouldNotHaveValidationErrorFor <T, TGreatGrandparent, TGrandparent, TParent, TChild>(this AbstractValidator <T> validator, Expression <Func <T, TGreatGrandparent> > greatGrandparentPropertyExpression, Expression <Func <T, TGrandparent> > grandparentPropertyExpression, Expression <Func <T, TParent> > parentPropertyExpression, Expression <Func <T, TChild> > childPropertyExpression, int index, T vacancyViewModel, string ruleSet = null) { var propertyName = GetPropertyName(greatGrandparentPropertyExpression, grandparentPropertyExpression, parentPropertyExpression, childPropertyExpression, index); var aggregateResult = string.IsNullOrEmpty(ruleSet) ? validator.Validate(vacancyViewModel) : validator.Validate(vacancyViewModel, ruleSet: ruleSet); aggregateResult.Errors.Count(e => e.PropertyName == propertyName).Should().Be(0); }
public bool Validate <TModel>(TModel model, AbstractValidator <TModel> validator) { ValidationResult = validator.Validate(model); return(Valid = ValidationResult.IsValid); }
internal static void AddServerRules(this AbstractValidator <ProviderSearchViewModel> validator) { validator.RuleFor(x => x) .Must(x => !string.IsNullOrEmpty(x.Id) || !string.IsNullOrEmpty(x.Ukprn) || !string.IsNullOrEmpty(x.Name) || !x.PerformSearch) .WithMessage(ProviderSearchViewModelMessages.NoSearchCriteriaErrorText); }
protected bool OnValidate <TEntity>(TEntity entity, AbstractValidator <TEntity> validator) { ValidationResult = validator.Validate(entity); return(IsValid); }
public bool Validate <TValueObject>(TValueObject valueObject, AbstractValidator <TValueObject> validator) { ValidationResult = validator.Validate(valueObject); return(IsValid = ValidationResult.IsValid); }
public TicketsService(IMapper mapper, AbstractValidator <Ticket> validator, IUnitOfWork uow) { this.mapper = mapper; this.validator = validator; this.uow = uow; }
public EditInventoryItemCommandHandler(ApplicationDbContext db, IMapper mapper, AbstractValidator <EditInventoryItemCommand> validator) { this.db = db; this.mapper = mapper; this.validator = validator; }
public ValidationWrapper(T data, AbstractValidator <T> validator) { _data = data; _validator = validator; _ruleSet = ""; }
public Task() { TaskValidator = new TaskValidator(); }
// Constructors public ValidationWrapper(T data, string ruleSet, AbstractValidator <T> validator) { _data = data; _validator = validator; _ruleSet = ruleSet; }
internal static void AddServerRules(this AbstractValidator <DateViewModel> validator) { }
public static void ShouldHaveValidationErrorFor <T, TGreatGrandparent, TGrandparent, TParent, TChild>(this AbstractValidator <T> validator, Expression <Func <T, TGreatGrandparent> > greatGrandparentPropertyExpression, Expression <Func <T, TGrandparent> > grandparentPropertyExpression, Expression <Func <T, TParent> > parentPropertyExpression, Expression <Func <T, TChild> > childPropertyExpression, T vacancyViewModel, string ruleSet = null) { var propertyName = GetPropertyName(greatGrandparentPropertyExpression, grandparentPropertyExpression, parentPropertyExpression, childPropertyExpression); var aggregateResult = string.IsNullOrEmpty(ruleSet) ? validator.Validate(vacancyViewModel) : validator.Validate(vacancyViewModel, ruleSet: ruleSet); var errors = aggregateResult.Errors.Where(e => e.PropertyName == propertyName).Select(e => e.ErrorMessage).ToList(); errors.Count.Should().BeGreaterThan(0); errors.Count.Should().Be(errors.Distinct().Count(), "All errors should be distinct. Found " + string.Join(", ", errors)); }
private void Validate(RegistroCadastro obj, AbstractValidator <RegistroCadastro> validator) => validator.ValidateAndThrow(obj);
public CommunitiesController(ICommunityService communityService, AbstractValidator <CommunityCriteriaModel> criteriaValidator) { _communityService = communityService; _criteriaValidator = criteriaValidator; }
public CartService(IMapper mapper, ShopDbContext dbContext, AbstractValidator <CartDto> validator) { _mapper = mapper; _dbContext = dbContext; _validator = validator; }
public EditorForm(IMemoryCache cache, IDialogService dialogService, FrameworkElement form, AbstractValidator <TItem> validator = null) : base(cache) { DialogService = dialogService; Form = form; Validator = validator; }
public GetAccountEventsQueryHandler(IAccountEventRepository accountEventRepository, AbstractValidator <GetAccountEventsRequest> validator) { if (accountEventRepository == null) { throw new ArgumentNullException(nameof(accountEventRepository)); } if (validator == null) { throw new ArgumentNullException(nameof(validator)); } _accountEventRepository = accountEventRepository; _validator = validator; }
public ValidationBehavior(AbstractValidator <TRequest> validator) { _validator = validator ?? throw new ArgumentNullException(nameof(validator)); }
public StewadressService(IUnitOfWork uow, IMapper map, AbstractValidator <StewadressDto> rules) { unit = uow; mapper = map; validator = rules; }
public MembersController(IMemberService memberService, AbstractValidator <MemberCriteriaModel> criteriaValidator) { _memberService = memberService; _criteriaValidator = criteriaValidator; }
protected CrudableRepositoryBase(AbstractValidator <TEntity> validator) : base(validator) { }
public void SetUp() { // can replace this with the // Admin.ViewModels.BankAccountViewModel // and the tests still pass. Sut = new Admin.ViewModels.BankAccountViewModel //new Core.BankAccount { BankAccountName = "ASDFASDF", AccountNumber = "ASDFASDFLKJ-", }; Validator = new BankAccountValidator(); }
public void Setup() { validator = new TestValidator(); }
internal static void AddClientRules(this AbstractValidator <ProviderSearchViewModel> validator) { }
public PropertyRuleValidatorExtensionsTester() { validator = new TestValidator(); }
protected ValidationHandler(AbstractValidator <T> validationRules) { ValidationRules = validationRules; }
public PlaneService(IUnitOfWork uow, IMapper map, AbstractValidator <PlaneDto> rules) { unit = uow; mapper = map; validator = rules; }
internal static void AddServerRules(this AbstractValidator <TraineeshipApplicationViewModel> validator) { }
public ItemServiceImpl(Func <ICatalogRepository> catalogRepositoryFactory, ICommerceService commerceService, IOutlineService outlineService, IAssociationService associationService, ICatalogService catalogService, ICategoryService categoryService, AbstractValidator <IHasProperties> hasPropertyValidator) { _catalogService = catalogService; _categoryService = categoryService; _commerceService = commerceService; _outlineService = outlineService; _associationService = associationService; _repositoryFactory = catalogRepositoryFactory; _hasPropertyValidator = hasPropertyValidator; }
public ImportanceService(ImportanceRepository importanceRepository, IMapper mapper, AbstractValidator <ImportanceDTO> validator) { this.repository = importanceRepository; this.mapper = mapper; this.validator = validator; }
public GenericRepository(AbstractValidator <T> validator) { this.validator = validator; db = new SQLConection(); }
public PilotsService( IRepository <Pilot> repository, IMapper mapper, AbstractValidator <Pilot> validator) : base(repository, mapper, validator) { }