示例#1
0
        public ChannelTests()
        {
            //load settings from appsettings.json
            IConfigurationBuilder builder = new ConfigurationBuilder()
                                            .AddJsonFile("appSettings.json").AddJsonFile("appSettings.Development.json", optional: true);

            Configuration = builder.Build();

            // register services
            IServiceCollection services = new ServiceCollection();

            services.Configure <AcrCloudOptions>(Configuration.GetSection("AcrCloud"));

            // pull registered Services
            var ServiceProvider = services.BuildServiceProvider();
            var acrCloudOptions = ServiceProvider.GetService <IOptions <AcrCloudOptions> >();

            options = acrCloudOptions.Value;
        }
 public AcrCloudConsoleService(AcrCloudOptions options)
 {
     _options = options;
 }