Beispiel #1
0
 public RequestService(IHttpService httpService, IDBService dbService, IRequestDBService requestDBService, IOptions <ServicesOptions> options)
 {
     _httpService      = httpService;
     _dbService        = dbService;
     _requestDBService = requestDBService;
     _config           = options.Value;
 }
 public ConsultarValorTotalInvestidoHandler(IOptionsSnapshot <ServicesOptions> investimentosServiceOption,
                                            ILogger <ConsultarValorTotalInvestidoHandler> logger, IFundosService fundosService,
                                            ITesouroDiretoService tesouroDiretoService, IRendaFixaService rendaFixaService)
 {
     this._servicesOptions = investimentosServiceOption?.Value;
     _logger               = logger ?? throw new ArgumentNullException(nameof(logger));
     _fundosService        = fundosService ?? throw new ArgumentNullException(nameof(fundosService));
     _tesouroDiretoService = tesouroDiretoService ?? throw new ArgumentNullException(nameof(tesouroDiretoService));
     _rendaFixaService     = rendaFixaService ?? throw new ArgumentNullException(nameof(rendaFixaService));
 }
Beispiel #3
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddTransient <CookieManager>();
            //    services.AddTransient<ServicesOptions>();
            ServicesOptions servicesOptions = new ServicesOptions();

            services.AddTransient(BpmAuthorization => new HttpAuthorization(servicesOptions));
            services.AddTransient <IDataService>(BpmHttpService => new HttpDataService(servicesOptions, CookieManager.bpmCookieContainer));
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
        }
        public void Constructor_ThrowsForNulls()
        {
            var emptyConfig = TestHelpers.GetConfigurationFromDictionary(new Dictionary <string, string>());
            var appInfo     = new ApplicationInstanceInfo(emptyConfig);
            var serviceInfo = new ServicesOptions(emptyConfig);
            var ex          = Assert.Throws <ArgumentNullException>(() => new CloudFoundryForwarderOptions(null, serviceInfo, emptyConfig));

            Assert.Equal("appInfo", ex.ParamName);
            ex = Assert.Throws <ArgumentNullException>(() => new CloudFoundryForwarderOptions(appInfo, null, emptyConfig));
            Assert.Equal("serviceInfo", ex.ParamName);
            ex = Assert.Throws <ArgumentNullException>(() => new CloudFoundryForwarderOptions(appInfo, serviceInfo, null));
            Assert.Equal("config", ex.ParamName);
        }
Beispiel #5
0
        private void BuildServiceInfos()
        {
            ServiceInfos.Clear();

            var appInfo     = new ApplicationInstanceInfo(_config);
            var serviceOpts = new ServicesOptions(_config);

            foreach (var serviceopt in serviceOpts.Services)
            {
                foreach (var s in serviceopt.Value)
                {
                    var factory = FindFactory(s);
                    if (factory != null && factory.Create(s) is ServiceInfo info)
                    {
                        info.ApplicationInfo = appInfo;
                        ServiceInfos.Add(info);
                    }
                }
            }
        }