Пример #1
0
        private void RegisterDependencies(IServiceCollection services)
        {
            var dbConfig = new TodoDbConfig();

            Configuration.Bind("DbConfig", dbConfig);

            var apiConfig = new ExternalTodoApiConfig();

            Configuration.Bind("ApiConfig", apiConfig);


            services.AddSingleton(dbConfig);
            services.AddSingleton(apiConfig);
            services.AddSingleton <ITodoManagementService, TodoManagementService>();
            services.AddSingleton <ITodoRepository, FakeTodoRepository>();
            services.AddSingleton <IExternalTodoApi, FakeExternalTodoApiService>();
        }
 public FakeExternalTodoApiService(ExternalTodoApiConfig config)
 {
     _config = config;
 }