예제 #1
0
 public ConsoleProfileSetup(IProfileManager profileManager, IInputValidator inputValidator, IRegionConverter regionConverter, IRegionData regionData)
 {
     _profileManager  = profileManager;
     _inputValidator  = inputValidator;
     _regionConverter = regionConverter;
     _regionData      = regionData;
 }
예제 #2
0
        private static void RunOption(ConsoleOption opts)
        {
            if (opts.FileSystem.ToUpperInvariant() == "MEMORY")
            {
                fileCabinetService = new FileCabinetMemoryService(recordValidators[opts.Validator.ToUpperInvariant()]);
                inputValidator     = inputValidators[opts.Validator.ToUpperInvariant()];
                Console.WriteLine("Using {0} validation rules.", opts.Validator.ToUpperInvariant());
            }

            if (opts.FileSystem.ToUpperInvariant() == "FILE")
            {
                fileCabinetService = new FileCabinetFileSystemService(recordValidators[opts.Validator.ToUpperInvariant()]);
                inputValidator     = inputValidators[opts.Validator.ToUpperInvariant()];
                Console.WriteLine("Using {0} validation rules.", opts.Validator.ToUpperInvariant());
            }

            if (opts.Watch)
            {
                fileCabinetService = new ServiceMeter(fileCabinetService);
            }

            if (opts.Logger)
            {
                fileCabinetService = new ServiceLogger(fileCabinetService);
            }
        }
예제 #3
0
    protected RequestValidatorBase(IInputValidator validator, IOptions <SimpleS3Config> config)
    {
        _validator = validator;
        _cfg       = config.Value;

        RuleFor(x => x.Method).IsInEnum().Must(x => x != HttpMethodType.Unknown);

        When(x => x is IHasUploadId, () => RuleFor(x => ((IHasUploadId)x).UploadId).NotEmpty());

        When(x => x is IHasSseCustomerKey key && key.SseCustomerAlgorithm != SseCustomerAlgorithm.Unknown, () =>
        {
            RuleFor(x => ((IHasSseCustomerKey)x).SseCustomerAlgorithm).NotEmpty();
            RuleFor(x => ((IHasSseCustomerKey)x).SseCustomerKey).NotNull().Must(x => x != null && x.Length == 32);
            RuleFor(x => ((IHasSseCustomerKey)x).SseCustomerKeyMd5).NotNull().Must(x => x != null && x.Length == 16);
        });

        //See https://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html
        //- Can contain multiple DNS labels, which must start with lowercase letter or digit
        //- Other than the start character, it must also contain hyphens
        //- Must be between 3 and 63 long
        When(x => x is IHasBucketName,
             () => RuleFor(x => ((IHasBucketName)x).BucketName)
             .Custom(ValidateBucketName));

        When(x => x is IHasObjectKey,
             () => RuleFor(x => ((IHasObjectKey)x).ObjectKey)
             .Custom(ValidateObjectKey));
    }
예제 #4
0
 public Engine(ITaxCalculatorService taxCalculatorService, IReader reader, IWriter writer, IInputValidator inputValidator)
 {
     this.taxCalculatorService = taxCalculatorService;
     this.reader         = reader;
     this.writer         = writer;
     this.inputValidator = inputValidator;
 }
 public DictionaryController(
     IClientDictionary clientDictionary,
     IInputValidator inputValidator)
 {
     _clientDictionary = clientDictionary;
     _inputValidator   = inputValidator;
 }
 public void Setup()
 {
     _inputValidator = new InputValidator(new InputConfiguration());
     _roverFactory   = new RoverFactory();
     _plateauFactory = new PlateauFactory();
     _movingService  = new NavigationService(_inputValidator, _roverFactory, _plateauFactory);
 }
예제 #7
0
 public void Init()
 {
     _calculator     = new Calculator();
     _inputValidator = new InputValidator();
     _romanToNumbers = new NumberConverter();
     _processor      = new Processor(_calculator, _inputValidator, _romanToNumbers);
 }
예제 #8
0
        public void GetInputValidator_Should_WorkSingleton_When_CallFor_ICommandList()
        {
            IInputValidator inputValidator1 = _factory.GetInputValidator <ICommandList>();
            IInputValidator inputValidator2 = _factory.GetInputValidator <ICommandList>();

            Assert.AreSame(inputValidator1, inputValidator2);
        }
예제 #9
0
        public void GetInputValidator_Should_WorkSingleton_When_CallFor_IPosition()
        {
            IInputValidator inputValidator1 = _factory.GetInputValidator <IPosition>();
            IInputValidator inputValidator2 = _factory.GetInputValidator <IPosition>();

            Assert.AreSame(inputValidator1, inputValidator2);
        }
        public Boolean GetBoolean(IInputValidator validator = null)
        {
            if (String.IsNullOrEmpty(label))
            {
                throw new InvalidOperationException("Needs a label.");
            }

            Console.Write(label);
            String  stringValue = Console.ReadLine();
            Boolean valid       = Boolean.TryParse(stringValue, out Boolean value);

            if (validator == null)
            {
                return(value);
            }

            while (!valid && !validator.Validate(stringValue))
            {
                Console.WriteLine(validator.InvalidMessage);
                Console.Write(label);
                stringValue = Console.ReadLine();
                valid       = Boolean.TryParse(stringValue, out value);
            }

            return(value);
        }
예제 #11
0
 public void Validation(IInputValidator validator)
 {
     this.Name        = validator.ValidateString(Name);
     this.Number      = validator.ValidateString(Number);
     this.Description = validator.ValidateString(Description);
     this.Email       = validator.ValidateString(Email);
 }
예제 #12
0
 public ApplicationController(IInputValidator validator,
                              ISearchStatisticsService statisticsService,
                              ISearchStatisticsPresenter presenter)
 {
     inputValidator            = validator;
     searchStatisticsService   = statisticsService;
     searchStatisticsPresenter = presenter;
 }
예제 #13
0
 public GetTotalPrizeMoneyCommand(IDataReader dataReader,
                                  IInputValidator validator,
                                  ICampaign campaign)
 {
     _dataReader = dataReader;
     _validator  = validator;
     _campaign   = campaign;
 }
예제 #14
0
 public FileReverser(IOutputter outputter, IInput input, IInputValidator inputValidator, IOutputValidator outputValidator, IReverserImplementation reverserImplementation)
 {
     _outputter = outputter;
     _input = input;
     _inputValidator = inputValidator;
     _outputValidator = outputValidator;
     _reverserImplementation = reverserImplementation;
 }
예제 #15
0
 public FileReverser(IOutputter outputter, IInput input, IInputValidator inputValidator, IOutputValidator outputValidator, IReverserImplementation reverserImplementation)
 {
     _outputter              = outputter;
     _input                  = input;
     _inputValidator         = inputValidator;
     _outputValidator        = outputValidator;
     _reverserImplementation = reverserImplementation;
 }
예제 #16
0
 public CalculatorClient(ICalculator calculator, IInputParser parser,
                         IInputValidator validator, IOperatorProvider operatorProvider)
 {
     _calculator       = calculator ?? throw new System.ArgumentNullException(nameof(calculator));
     _parser           = parser ?? throw new System.ArgumentNullException(nameof(parser));
     _validator        = validator ?? throw new System.ArgumentNullException(nameof(validator));
     _operatorProvider = operatorProvider ?? throw new System.ArgumentNullException(nameof(operatorProvider));
 }
예제 #17
0
        public InputValidatorShould()
        {
            var configuration = A.Fake <IConfiguration>();

            A.CallTo(() => configuration.MaxNumver).Returns(1000);

            _validator = new InputValidator(configuration);
        }
예제 #18
0
 public ProfileManager(IInputValidator validator, IProfileSerializer serializer, IStorage storage, IOptions <ProfileManagerOptions> options, IAccessKeyProtector?protector = null)
 {
     _validator  = validator;
     _serializer = serializer;
     _storage    = storage;
     _config     = options.Value;
     _protector  = protector;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CreateCommandHandler"/> class.
 /// </summary>
 /// <param name="fileCabinetService">The file cabinet service.</param>
 /// <param name="inputConverter">The input converter.</param>
 /// <param name="inputValidator">The input validator.</param>
 /// <param name="writeDelegate">The write delegate.</param>
 public CreateCommandHandler(
     IFileCabinetService fileCabinetService, IInputConverter inputConverter, IInputValidator inputValidator, Action <string> writeDelegate)
     : base(fileCabinetService)
 {
     this.converter = inputConverter;
     this.validator = inputValidator;
     write          = writeDelegate;
 }
예제 #20
0
    public static void ValidateKeyIdAndThrow(this IInputValidator validator, string?keyId)
    {
        if (validator.TryValidateKeyId(keyId, out ValidationStatus status, out string?message))
        {
            return;
        }

        throw new ArgumentException("Invalid key id: " + ValidationMessages.GetMessage(status, message), nameof(keyId));
    }
예제 #21
0
    public static void ValidateAccessKeyAndThrow(this IInputValidator validator, byte[]?accessKey)
    {
        if (validator.TryValidateAccessKey(accessKey, out ValidationStatus status, out string?message))
        {
            return;
        }

        throw new ArgumentException("Invalid access key: " + ValidationMessages.GetMessage(status, message), nameof(accessKey));
    }
예제 #22
0
 public FilterFeedbacksOperation(
     IBusinessLogicValidator businessLogicValidator,
     IInputValidator inputValidator,
     IAllTeams allTeams)
 {
     this.businessLogicValidator = businessLogicValidator;
     this.inputValidator         = inputValidator;
     this.allTeams = allTeams;
 }
 public FilterBugsByPriorityOperation(
     IBusinessLogicValidator businessLogicValidator,
     IInputValidator inputValidator,
     IAllTeams allTeams)
 {
     this.businessLogicValidator = businessLogicValidator;
     this.inputValidator         = inputValidator;
     this.allTeams = allTeams;
 }
예제 #24
0
    public static void ValidateObjectKey(this IInputValidator validator, string?objectKey, ObjectKeyValidationMode mode)
    {
        if (validator.TryValidateObjectKey(objectKey, mode, out ValidationStatus status, out string?message))
        {
            return;
        }

        throw new ArgumentException("Invalid object key: " + ValidationMessages.GetMessage(status, message), nameof(objectKey));
    }
        public CalculatorClientShould()
        {
            _calculator       = A.Fake <ICalculator>();
            _inputParser      = A.Fake <IInputParser>();
            _inputValidator   = A.Fake <IInputValidator>();
            _operatorProvider = A.Fake <IOperatorProvider>();

            _calculatorClient = new CalculatorClient(_calculator, _inputParser, _inputValidator, _operatorProvider);
        }
 public SortStoriesByOperation(
     IBusinessLogicValidator businessLogicValidator,
     IInputValidator inputValidator,
     IAllTeams allTeams)
 {
     this.businessLogicValidator = businessLogicValidator;
     this.inputValidator         = inputValidator;
     this.allTeams = allTeams;
 }
예제 #27
0
    public static void ValidateBucketName(this IInputValidator validator, BucketNameValidationMode mode, string?bucketName)
    {
        if (validator.TryValidateBucketName(bucketName, mode, out ValidationStatus status, out string?message))
        {
            return;
        }

        throw new ArgumentException("Invalid bucket name: " + ValidationMessages.GetMessage(status, message), nameof(bucketName));
    }
        public MainWindow(IInputValidator inputValidator, IWindowSettingsManager windowSettingsManager)
        {
            _inputValidator        = inputValidator;
            _windowSettingsManager = windowSettingsManager;
            InitializeComponent();
            var model = new MainViewModel("Md Shahjahan Miah", "2", "7.89", "1.45", "3.50", "7.89", true, RoundingType.Double, _inputValidator);

            DataContext = model;
        }
 public WordLadderApp(IInputValidator inputValidator, IWordDictionaryService wordDictionaryService,
                      IWordLadderSolver wordladderSolver, IOpenFileHelper openFileHelper, IFileWrapper fileWrapper)
 {
     _inputValidator        = inputValidator;
     _wordDictionaryService = wordDictionaryService;
     _wordladderSolver      = wordladderSolver;
     _openFileHelper        = openFileHelper;
     _fileWrapper           = fileWrapper;
 }
 public FilterStoriesByStatusOperation(
     IBusinessLogicValidator businessLogicValidator,
     IInputValidator inputValidator,
     IAllTeams allTeams)
 {
     this.businessLogicValidator = businessLogicValidator;
     this.inputValidator         = inputValidator;
     this.allTeams = allTeams;
 }
 public ListAllWorkItemsOperation(
     IBusinessLogicValidator businessLogicValidator,
     IInputValidator inputValidator,
     IAllTeams allTeams)
 {
     this.businessLogicValidator = businessLogicValidator;
     this.inputValidator         = inputValidator;
     this.allTeams = allTeams;
 }
예제 #32
0
 public InputReader()
 {
     LineValidator = null;
     InputMap = null;
 }
예제 #33
0
 public AbnfContentProcessor(IInputValidator validator)
 {
     // TODO: Inject summary provider/generator along with validator
     // generating summary can be moved to summary provider and invoke summary provider from Process method.
     _inputrValidator = validator;
 }
예제 #34
0
 public void Set(IInputValidator InValidator, ref IMinesMap InHolder)
 {
     LineValidator = InValidator;
     InputMap = InHolder;
 }
예제 #35
0
 public InputReader(IInputValidator InValidator, ref IMinesMap InHolder)
 {
     LineValidator = InValidator;
     InputMap = InHolder;
 }