Ejemplo n.º 1
0
 public AliceController(ILogger <AliceController> logger, IDialogsApiService dialogsApiService,
                        AliceSettings aliceSettings)
 {
     _logger            = logger;
     _dialogsApiService = dialogsApiService;
     _aliceSettings     = aliceSettings;
 }
 public DialogsApiFixture()
 {
     var configuration = new ConfigurationBuilder()
         .AddJsonFile("appsettings.json")
         .AddUserSecrets<DialogsApiFixture>()
         .Build();
     var skillIdSection = configuration.GetSection("AliceSettings:SkillId");
     AliceSettings = new AliceSettings(skillIdSection.Value);
     var apiSettings = new DialogsApiSettings(configuration.GetSection("AliceSettings:DialogsOAuthToken").Value);
     DialogsApiService = new DialogsApiService(apiSettings);
 }
Ejemplo n.º 3
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();

            string skillId       = Configuration["AliceSettings:SkillId"];
            var    aliceSettings = new AliceSettings(skillId);
            var    apiSettings   = new DialogsApiSettings(Configuration["AliceSettings:DialogsOAuthToken"]);

            services.AddSingleton(apiSettings);
            services.AddSingleton <IDialogsApiService, DialogsApiService>();
            services.AddSingleton(aliceSettings);

            services.AddSingleton <ICleanService, CleanService>();
            services.AddHostedService <CleanResourcesWorker>();
        }
Ejemplo n.º 4
0
 public CleanService(IDialogsApiService dialogsApiService, AliceSettings aliceSettings)
 {
     _dialogsApiService = dialogsApiService;
     _skillId           = aliceSettings.SkillId;
 }