public SMSService(IOptions <LuosimaoConfig> smsconfig, ICacheManager cacheManager , ILoggerFactory logger) { this.smsConfig = smsconfig.Value; this.cacheManager = cacheManager; this.logger = logger.CreateLogger("SMSService"); }
public LuosimaoSmsTests() { var configuration = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", false, true) .Build(); _config = configuration.GetSection("SMS:Luosimao").Get <LuosimaoConfig>(); _client = new LuosimaoClient(_config); }
public LuosimaoClient(LuosimaoConfig config, Action <Exception> exceptionHandler = null) { _config = config ?? throw new ArgumentNullException(nameof(config)); _luosimaoAccount = config.Account ?? throw new ArgumentNullException(nameof(config.Account)); _proxy = HttpApiClient.Create <ILuosimaoApi>(); var globalHandle = ExceptionHandleResolver.ResolveHandler(); globalHandle += exceptionHandler; _exceptionHandler = globalHandle; }