/// <summary> /// 使用融云通信 /// </summary> /// <param name="services"></param> /// <param name="setConfig"></param> public static IServiceCollection AddRongCloud(this IServiceCollection services, Action <RongCloudConfig> setConfig) { var config = new RongCloudConfig(); setConfig?.Invoke(config); return(services.AddRongCloud(config)); }
public RongCloudSmsTests() { var configuration = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", false, true) .Build(); _config = configuration.GetSection("SMS:RongCloud").Get <RongCloudConfig>(); _client = new RongCloudClient(_config); }
public RongCloudClient(RongCloudConfig config, Action <Exception> exceptionHandler = null) { _config = config ?? throw new ArgumentNullException(nameof(config)); _rongAccount = config.Account ?? throw new ArgumentNullException(nameof(config.Account)); _proxy = HttpApi.Create <IRongCloudSmsApis>(); var globalHandle = ExceptionHandleResolver.ResolveHandler(); globalHandle += exceptionHandler; _exceptionHandler = globalHandle; }
public void RongCloudSetAppKeyTest() { try { var appKey = ""; var config = new RongCloudConfig { AppKey = appKey }; } catch (Exception ex) { Assert.Equal(ex.Message, "rongcloud appkey must not be null or empty"); } }
public static IServiceCollection AddRongCloud(this IServiceCollection services, RongCloudConfig config) { services.AddSingleton <ILayIMAppInfo>(config); services.AddSingleton <ILayIMServer, RongCloudServer>(); services.AddSingleton <IApiActionFilter, ApiFilter>(); return(services); }