public static ProcessorType GetType(IStringProcessor processor) { if (processor is StringReplacer) { return(ProcessorType.StringReplacer); } if (processor is StringRemover) { return(ProcessorType.StringRemover); } if (processor is StringUpperCaser) { return(ProcessorType.StringUpperCaser); } if (processor is StringLowerCaser) { return(ProcessorType.StringLowerCaser); } if (processor is StringRegexUppercaser) { return(ProcessorType.StringRegexUppercaser); } if (processor is StringRegexLowercaser) { return(ProcessorType.StringRegexLowercaser); } if (processor is StringTrimer) { return(ProcessorType.StringTrimer); } if (processor is StringNameNormalizer) { return(ProcessorType.StringNameNormalizer); } if (processor is StringGUIDCreator) { return(ProcessorType.StringGUIDCreator); } if (processor is StringRepositioner) { return(ProcessorType.StringRepositioner); } if (processor is StringAdder) { return(ProcessorType.StringAdder); } if (processor is StringUppercaserAll) { return(ProcessorType.StringUppercaserAll); } if (processor is StringLowercaserAll) { return(ProcessorType.StringLowercaserAll); } return(ProcessorType.Null); }
public void Add(IStringProcessor processor) { lock (this._lockObj) { if (this.ProcessorsDictionary.ContainsKey(processor.Name)) { this.ProcessorsDictionary.Remove(processor.Name); } this.ProcessorsDictionary.Add(processor.Name, processor); } }
private void OnProcessText(object sender, RoutedEventArgs e) { IStringProcessor processor = availableProcessors.SelectedItem as IStringProcessor; if (processor != null) { string input = originalText.Text; string result = processor.Process(input); resultText.Text = result; } }
public StringService(BPFinanceContext context, IOptions <AppParams> appParamsAccessor) { _context = context; var repository = new BPFinanceRepository(_context, appParamsAccessor.Value.EditUserId); _stringProcessor = new StringProcessor( _context, repository); _handbookProcessor = new HandbookProcessor( _context, repository); }
public PositionImProcessor( BPFinanceContext context, IBPFinanceRepository repository, IOrderImProcessor orderImProcessor, IStringProcessor stringProcessor, IModuleProcessor moduleProcessor, IModuleMaketProcessor moduleMaketProcessor) { _context = context; _repository = repository; _orderImProcessor = orderImProcessor; _stringProcessor = stringProcessor; _moduleProcessor = moduleProcessor; _moduleMaketProcessor = moduleMaketProcessor; _positionImFactory = new PositionImFactory(); }
public StringTests() { // set up some test strings for use across the tests testStrings = new List <string>(); testStrings.Add("AAAc91%cWwWkLq$1ci3_848v3d__K"); // include some randomly-created strings of varying lengths // NOTE: Using randomly-generated strings has benefits and disadvantages. One benefit is we can // quickly set up many strings with complex sequences. A downside could be that we can't be totally // sure what our tests are going to contain, so maybe a specific string sequence could cause a test // failure, and we won't see it on every test. However, I think this is something where you would // keep this in mind and look to improve the test over time. for (int i = 1; i < 50; i++) { testStrings.Add(RandomString(i, GENERATOR_CHARS)); testStrings.Add(RandomString(i, GENERATOR_CHARS)); } // Add an empty string and a null so we test these as well testStrings.Add(""); testStrings.Add(null); processor = new LDCStringProcessor(); }
public void RegisterProcessor(IStringProcessor processor) { this.StringProcessorHolder.Add(processor); }