Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of <see cref="DiffController"/>
 /// </summary>
 /// <param name="payLoadCreateService"></param>
 /// <param name="diffAnalyzerService"></param>
 /// <param name="responseHandler"></param>
 public DiffController(IPayLoadService payLoadCreateService, IDiffService diffAnalyzerService,
                       IResponseCreator responseHandler)
 {
     _payLoadCreateService = payLoadCreateService ?? throw new ArgumentNullException(nameof(payLoadCreateService));
     _diffAnalyzerService  = diffAnalyzerService ?? throw new ArgumentNullException(nameof(diffAnalyzerService));
     _responseCreator      = responseHandler ?? throw new ArgumentNullException(nameof(responseHandler));
 }
Ejemplo n.º 2
0
 public GetChannelCommand(
     IBaseFindFilterValidator baseFindValidator,
     IChannelRepository repository,
     IChannelInfoMapper channelMapper,
     IMessageInfoMapper messageMapper,
     IUserInfoMapper userMapper,
     IImageInfoMapper imageMapper,
     IHttpContextAccessor httpContextAccessor,
     IResponseCreator responseCreator,
     IRequestClient <IGetUsersDataRequest> rcGetUsers,
     IRequestClient <IGetImagesRequest> rcGetImages,
     ILogger <GetChannelCommand> logger)
 {
     _baseFindValidator   = baseFindValidator;
     _repository          = repository;
     _channelMapper       = channelMapper;
     _messageMapper       = messageMapper;
     _userMapper          = userMapper;
     _imageMapper         = imageMapper;
     _httpContextAccessor = httpContextAccessor;
     _responseCreator     = responseCreator;
     _rcGetUsers          = rcGetUsers;
     _rcGetImages         = rcGetImages;
     _logger = logger;
 }
Ejemplo n.º 3
0
        public void ValidateInput(IResponseCreator responseCreator, string prefix)
        {
            var iv = new InputValidator <Level2DTO>(this, responseCreator, prefix);

            iv.ForString(x => x.NameTest)
            .MinLength(1, NastedDTOValidationTests.TooShortValidationResult);
        }
        public void ValidateString(string input, string key, int minLength, int maxLength,
                                   bool expectedIsValid, int expectedNumberOfValidationResults,
                                   string[] expectedErrors,
                                   string displayMessage)
        {
            // arrange
            IResponseCreator responseCreator = ResponseCreatorDataFactory.Create();
            var inputValidator = new InputValidator <string>(input, responseCreator);

            // act
            inputValidator.ForString(x => x, key)
            .MinLength(minLength, MinLengthValidationResultMessage)
            .MaxLength(maxLength, MaxLengthValidationResultMessage);

            var actual = responseCreator.IsValid();
            var actualNumberOfValidationResultsForKey = responseCreator.NumberOfValidationResultsForKey(key);
            var actualValidationResults = responseCreator.GetValidationResultsForKey(key);

            // assert
            actual.ShouldBe(expectedIsValid, customMessage: displayMessage);
            actualNumberOfValidationResultsForKey.ShouldBe(expectedNumberOfValidationResults, customMessage: displayMessage);

            responseCreator.GetValidationResultsForKey(key).Count().ShouldBe(expectedErrors.Length);

            expectedErrors.ToList().ForEach(expectedError =>
            {
                actualValidationResults.ShouldContain(expectedError);
            });
        }
Ejemplo n.º 5
0
 public CreateMessageCommand(
     IHttpContextAccessor httpContextAccessor,
     ICreateMessageRequestValidator validator,
     IDbMessageMapper mapper,
     IUserInfoMapper userInfoMapper,
     IImageInfoMapper imageInfoMapper,
     IMessageRepository repository,
     IResponseCreator responseCreator,
     IHubContext <ChatHub> chatHub,
     ILogger <CreateMessageCommand> logger,
     IRequestClient <IGetUsersDataRequest> rcGetUsers,
     IRequestClient <IGetImagesRequest> rcGetImages,
     IMemoryCache cache,
     IOptions <MemoryCacheConfig> cacheOptions)
 {
     _httpContextAccessor = httpContextAccessor;
     _validator           = validator;
     _mapper          = mapper;
     _userInfoMapper  = userInfoMapper;
     _imageInfoMapper = imageInfoMapper;
     _repository      = repository;
     _responseCreator = responseCreator;
     _chatHub         = chatHub;
     _logger          = logger;
     _rcGetUsers      = rcGetUsers;
     _rcGetImages     = rcGetImages;
     _cache           = cache;
     _cacheOptions    = cacheOptions;
 }
 public LanguageController(ILanguageService languageService, IMapper mapper,
                           IUserTokenCreator tokenCreator, IResponseCreator responseCreator)
 {
     _languageService = languageService;
     _tokenCreator    = tokenCreator;
     _responseCreator = responseCreator;
 }
Ejemplo n.º 7
0
 public UserController(IUserService userService, IMapper mapper, IUserTokenCreator tokenCreator, IResponseCreator responseCreator)
 {
     _userService     = userService;
     _mapper          = mapper;
     _tokenCreator    = tokenCreator;
     _responseCreator = responseCreator;
 }
        public DiffControllerTests()
        {
            _payLoadService  = Substitute.For <IPayLoadService>();
            _diffService     = Substitute.For <IDiffService>();
            _responseCreator = Substitute.For <IResponseCreator>();

            _sut = new DiffController(_payLoadService, _diffService, _responseCreator);
        }
Ejemplo n.º 9
0
        public void ValidateInput(IResponseCreator responseCreator, string prefix = null)
        {
            var iv = new InputValidator <Level1DTO>(this, responseCreator);

            iv.ForString(x => x.NameTest)
            .MinLength(1, NastedDTOValidationTests.TooShortValidationResult);

            this.Level2.ValidateInput(responseCreator, nameof(Level2));
        }
Ejemplo n.º 10
0
 public RequestBehavior(HttpStatusCode statusCode, Func <string, bool> urlMatcher, HttpMethod method, IRequestProcessor requestProcessor, IResponseCreator responseCreator, Uri location, IDictionary <string, string> headers)
 {
     this.method      = method;
     ResponseCreator  = responseCreator;
     Location         = location;
     StatusCode       = statusCode;
     this.urlMatcher  = urlMatcher;
     RequestProcessor = requestProcessor;
     Headers          = headers;
 }
 public GetRightsListCommand(
     IRightLocalizationRepository repository,
     IRightInfoMapper mapper,
     IAccessValidator accessValidator,
     IResponseCreator responseCreator)
 {
     _repository      = repository;
     _mapper          = mapper;
     _accessValidator = accessValidator;
     _responseCreator = responseCreator;
 }
 public FindWorkspaceCommand(
     IBaseFindFilterValidator baseFindValidator,
     IWorkspaceRepository repository,
     IShortWorkspaceInfoMapper mapper,
     IResponseCreator responseCreator)
 {
     _baseFindValidator = baseFindValidator;
     _repository        = repository;
     _mapper            = mapper;
     _responseCreator   = responseCreator;
 }
 public EditRoleStatusCommand(
     IRoleRepository roleRepository,
     IAccessValidator accessValidator,
     IResponseCreator responseCreator,
     IMemoryCache cache)
 {
     _roleRepository  = roleRepository;
     _accessValidator = accessValidator;
     _responseCreator = responseCreator;
     _cache           = cache;
 }
 public EditRoleLocalizationCommand(
     IAccessValidator accessValidator,
     IResponseCreator responseCreator,
     IRoleLocalizationRepository roleLocalizationRepository,
     IPatchDbRoleLocalizationMapper roleLocalizationMapper,
     IEditRoleLocalizationRequestValidator validator)
 {
     _accessValidator            = accessValidator;
     _responseCreator            = responseCreator;
     _roleLocalizationRepository = roleLocalizationRepository;
     _roleLocalizationMapper     = roleLocalizationMapper;
     _validator = validator;
 }
Ejemplo n.º 15
0
 public RemoveRightsFromUserCommand(
     IUserRepository repository,
     IRightsIdsValidator validator,
     IAccessValidator accessValidator,
     IResponseCreator responseCreator,
     IMemoryCache cache)
 {
     _repository      = repository;
     _validator       = validator;
     _accessValidator = accessValidator;
     _responseCreator = responseCreator;
     _cache           = cache;
 }
 public SnippetController(IUserService userService, IUserTokenCreator tokenCreator,
                          IResponseCreator responseCreator, ITagService tagService,
                          ISnippetService snippetService, ILanguageService languageService,
                          IMapper mapper)
 {
     _userService     = userService;
     _tokenCreator    = tokenCreator;
     _responseCreator = responseCreator;
     _tagService      = tagService;
     _snippetService  = snippetService;
     _languageService = languageService;
     _mapper          = mapper;
 }
 public CreateWorkspaceCommand(
     ICreateWorkspaceRequestValidator validator,
     IDbWorkspaceMapper mapper,
     IWorkspaceRepository repository,
     IHttpContextAccessor httpContextAccessor,
     IResponseCreator responseCreator)
 {
     _validator           = validator;
     _mapper              = mapper;
     _repository          = repository;
     _httpContextAccessor = httpContextAccessor;
     _responseCreator     = responseCreator;
 }
 public CreateRoleLocalizationCommand(
     IAccessValidator accessValidator,
     IResponseCreator responseCreator,
     IRoleLocalizationRepository roleLocalizationRepository,
     IDbRoleLocalizationMapper roleLocalizationMapper,
     ICreateRoleLocalizationRequestValidator requestValidator,
     IHttpContextAccessor httpContextAccessor)
 {
     _accessValidator            = accessValidator;
     _responseCreator            = responseCreator;
     _roleLocalizationRepository = roleLocalizationRepository;
     _roleLocalizationMapper     = roleLocalizationMapper;
     _requestValidator           = requestValidator;
     _httpContextAccessor        = httpContextAccessor;
 }
 public EditFileCommand(
     IAccessValidator accessValidator,
     IHttpContextAccessor httpContextAccessor,
     IResponseCreator responseCreator,
     IFileRepository fileRepository,
     IPatchDbFileMapper mapper,
     IEditFileRequestValidator requestValidator)
 {
     _accessValidator     = accessValidator;
     _fileRepository      = fileRepository;
     _httpContextAccessor = httpContextAccessor;
     _responseCreator     = responseCreator;
     _mapper           = mapper;
     _requestValidator = requestValidator;
 }
 public CreateChannelCommand(
     IWorkspaceUserRepository workspaceUserRepository,
     ICreateChannelRequestValidator validator,
     IDbChannelMapper channelMapper,
     IChannelRepository channelRepository,
     IHttpContextAccessor httpContextAccessor,
     IResponseCreator responseCreator)
 {
     _workspaceUserRepository = workspaceUserRepository;
     _validator           = validator;
     _channelMapper       = channelMapper;
     _channelRepository   = channelRepository;
     _httpContextAccessor = httpContextAccessor;
     _responseCreator     = responseCreator;
 }
 public UpdateRoleRightsCommand(
     IRoleRepository roleRepository,
     IDbRoleRightMapper dbRoleRightMapper,
     IHttpContextAccessor httpContextAccessor,
     IAccessValidator accessValidator,
     IUpdateRoleRightsRequestValidator requestValidator,
     IMemoryCache cache,
     IResponseCreator responseCreator)
 {
     _roleRepository      = roleRepository;
     _dbRoleRightMapper   = dbRoleRightMapper;
     _httpContextAccessor = httpContextAccessor;
     _accessValidator     = accessValidator;
     _requestValidator    = requestValidator;
     _cache           = cache;
     _responseCreator = responseCreator;
 }
 public CreateRoleCommand(
     IHttpContextAccessor httpContextAccessor,
     IRoleRepository roleRepository,
     ICreateRoleRequestValidator validator,
     IDbRoleMapper mapper,
     IAccessValidator accessValidator,
     IMemoryCache cache,
     IResponseCreator responseCreator)
 {
     _validator           = validator;
     _httpContextAccessor = httpContextAccessor;
     _roleRepository      = roleRepository;
     _mapper          = mapper;
     _accessValidator = accessValidator;
     _cache           = cache;
     _responseCreator = responseCreator;
 }
 public EditWorkspaceCommand(
     IEditWorkspaceRequestValidator validator,
     IPatchDbWorkspaceMapper mapper,
     IWorkspaceRepository repository,
     IWorkspaceUserRepository userRepository,
     IAccessValidator accessValidator,
     IHttpContextAccessor httpContextAccessor,
     IResponseCreator responseCreator)
 {
     _validator           = validator;
     _mapper              = mapper;
     _repository          = repository;
     _userRepository      = userRepository;
     _accessValidator     = accessValidator;
     _httpContextAccessor = httpContextAccessor;
     _responseCreator     = responseCreator;
 }
Ejemplo n.º 24
0
 public CreateUserRightsCommand(
     IUserRepository repository,
     IRightsIdsValidator validator,
     IAccessValidator accessValidator,
     IResponseCreator responseCreator,
     IRequestClient <ICheckUsersExistence> rcCheckUser,
     ILogger <CreateUserRightsCommand> logger,
     IHttpContextAccessor httpContextAccessor,
     IMemoryCache cache)
 {
     _repository          = repository;
     _validator           = validator;
     _accessValidator     = accessValidator;
     _responseCreator     = responseCreator;
     _rcCheckUser         = rcCheckUser;
     _logger              = logger;
     _httpContextAccessor = httpContextAccessor;
     _cache = cache;
 }
Ejemplo n.º 25
0
 public GetWorkspaceCommand(
     IWorkspaceInfoMapper workspaceInfoMapper,
     IImageInfoMapper imageMapper,
     IUserInfoMapper userMapper,
     IWorkspaceRepository repository,
     IRequestClient <IGetUsersDataRequest> rcGetUsers,
     IRequestClient <IGetImagesRequest> rcGetImages,
     ILogger <GetWorkspaceCommand> logger,
     IResponseCreator responseCreator,
     IHttpContextAccessor httpContextAccessor)
 {
     _workspaceInfoMapper = workspaceInfoMapper;
     _imageMapper         = imageMapper;
     _userMapper          = userMapper;
     _repository          = repository;
     _rcGetUsers          = rcGetUsers;
     _rcGetImages         = rcGetImages;
     _logger              = logger;
     _responseCreator     = responseCreator;
     _responseCreator     = responseCreator;
     _httpContextAccessor = httpContextAccessor;
 }
Ejemplo n.º 26
0
        public TResponse Begin <TPayment, TResponse>(
            TPayment payment,
            IStartPaymentStrategy <TPayment, TResponse> paymentStrategy,
            IResponseCreator <TResponse> responseCreator)
            where TPayment : OnlinePayment
            where TResponse : IStartOnlinePaymentResponse
        {
            if (!IsItemValidToPurchase(payment))
            {
                var errorResponse = responseCreator.Create();
                errorResponse.AddError("Invalid item being paid for");
                return(errorResponse);
            }

            var populatedOnlinePayment = GetPopulatedPayment(payment);

            var response = paymentStrategy.StartPayment(populatedOnlinePayment);

            _repository.Create(populatedOnlinePayment);

            return(response);
        }
Ejemplo n.º 27
0
        public ImposterRule Then(IResponseCreator responseCreator)
        {
            _imposter.CreateRuleAction(responseCreator);

            return(new ImposterRule(_imposter));
        }
Ejemplo n.º 28
0
 internal void SetAction(IResponseCreator responseCreator)
 {
     ResponseCreatorAction = responseCreator;
 }
Ejemplo n.º 29
0
 internal void CreateRuleAction(IResponseCreator responseCreator)
 {
     _newRule.SetAction(responseCreator);
 }
Ejemplo n.º 30
0
 public ResponsePraser(IResponseCreator responseCreator)
 {
     _responseCreator = responseCreator;
 }
Ejemplo n.º 31
0
 public ResponsePraser(IResponseCreator responseCreator)
 {
     _responseCreator = responseCreator;
 }