예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SearchCommand" /> class.
        /// </summary>
        /// <param name="maxRunsText">The maximum runs text.</param>
        /// <param name="city">The city.</param>
        /// <param name="state">The state.</param>
        /// <param name="zip">The zip.</param>
        /// <param name="namesFilePath">The names text file path.</param>
        /// <param name="options">The options.</param>
        public SearchCommand(string maxRunsText, string city, string state, string zip, string namesFilePath, CommandLineOptions options)
        {
            int.TryParse(maxRunsText, out int maxRuns);
            _maxRuns          = maxRuns;
            _city             = city;
            _state            = state;
            _zip              = zip;
            _namesFilePath    = namesFilePath;
            _resultOutputPath = Program.SearchResultsDirectory;
            _options          = options;

            this.Repository           = Program.Repository;
            this.Configuration        = Program.Configuration;
            this.FindPersonController = new FindPersonController(this.Configuration);
            this.Import             = new Import();
            this.Export             = new Export();
            this.Mapper             = MapperFactory.Get();
            this.SerializerSettings = JsonSerializerSettingsFactory.Get();


            //Default Value
            this.SearchWaitMs = 60000;
            var waitMs = Configuration.GetValue <string>("SearchSettings:WaitMs");

            int.TryParse(waitMs, out this.SearchWaitMs);


            this.PeopleSearch = new PeopleSearch(Repository, FindPersonController, SerializerSettings, Mapper, Export, _resultOutputPath, SearchWaitMs);
        }
예제 #2
0
        public FindPersonController_ShouldReturnJsonResult()
        {
            var builder = new ConfigurationBuilder()
                          .AddJsonFile("appsettings.json");
            var configuration = builder.Build();

            this.Controller = new FindPersonController(configuration);
        }
예제 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PersonSearchRequestHelper"/> class.
 /// </summary>
 /// <param name="repository">The repository.</param>
 /// <param name="findPersonController">The find person controller.</param>
 /// <param name="export">The export.</param>
 public PersonSearchRequestHelper(IEntityFrameworkRepository repository,
                                  IFindPersonController findPersonController,
                                  JsonSerializerSettings serializerSettings,
                                  IMapper mapper,
                                  IExport export,
                                  string resultOutputPath)
 {
     this.Repository           = repository;
     this.SerializerSettings   = serializerSettings;
     this.FindPersonController = findPersonController;
     this.Mapper           = mapper;
     this.Export           = export;
     this.ResultOutputPath = resultOutputPath;
 }
예제 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PeopleFinder" /> class.
        /// </summary>
        /// <param name="repository">The repository.</param>
        /// <param name="findPersonController">The find person controller.</param>
        /// <param name="serializerSettings">The serializer settings.</param>
        /// <param name="mapper">The mapper.</param>
        /// <param name="export">The export.</param>
        /// <param name="resultOutputPath">The result output path.</param>
        /// <param name="searchWaitMs">The search wait ms.</param>
        public PeopleSearch(IEntityFrameworkRepository repository,
                            IFindPersonController findPersonController,
                            JsonSerializerSettings serializerSettings,
                            IMapper mapper,
                            IExport export,
                            string resultOutputPath,
                            int searchWaitMs)
        {
            this.Repository           = repository;
            this.FindPersonController = findPersonController;
            this.SerializerSettings   = serializerSettings;
            this.Mapper           = mapper;
            this.SearchWaitMs     = searchWaitMs;
            this.ResultOutputPath = resultOutputPath;

            this.PersonSearchRequestHelper = new PersonSearchRequestHelper(repository, findPersonController, serializerSettings, mapper, export, this.ResultOutputPath);
            this.PersonSearchResultHelper  = new PersonSearchResultHelper(repository, serializerSettings, mapper);
        }