Esempio n. 1
0
 public SMSService(IOptions <LuosimaoConfig> smsconfig,
                   ICacheManager cacheManager
                   , ILoggerFactory logger)
 {
     this.smsConfig    = smsconfig.Value;
     this.cacheManager = cacheManager;
     this.logger       = logger.CreateLogger("SMSService");
 }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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;
        }