public void SetUp() { var modulDengiAccessConfig = new ModulDengiAccessConfig { SiteUrl = "https://cabinet.moduldengi.ru", MyCompanyId = MyCompanyId, Credential = new Credential { Login = "", Password = "" } }; var services = new ServiceCollection() .AddOptions() .AddSingleton(Options.Create(modulDengiAccessConfig)) .AddTransient <IModulDengiApi, ModulDengiApi>() .AddTransient(provider => new HttpRequestBuilder(enableLogging: false)); var serviceProvider = services.BuildServiceProvider(); this.modulDengiApi = serviceProvider.GetService <IModulDengiApi>(); }
public ModulDengiClient(IModulDengiApi api, IOptions <ModulDengiAccessConfig> accessConfig) { this.api = api; this.accessConfig = accessConfig.Value; }
public ModulDengiApi(IOptions <ModulDengiAccessConfig> accessConfig, HttpRequestBuilder httpRequestBuilder) { this.httpRequestBuilder = httpRequestBuilder; this.accessConfig = accessConfig.Value; }