/// <summary> /// ctor /// </summary> /// <param name="name">The name of the API this client is for</param> /// <param name="options">The options for this client</param> protected BaseRestClient(string name, BaseRestClientOptions options) : base(name, options) { if (options == null) { throw new ArgumentNullException(nameof(options)); } ClientOptions = options; RequestFactory.Configure(options.RequestTimeout, options.Proxy, options.HttpClient); }
/// <summary> /// ctor /// </summary> /// <param name="options">The base client options</param> /// <param name="apiOptions">The Api client options</param> public RestApiClient(BaseRestClientOptions options, RestApiClientOptions apiOptions) : base(options, apiOptions) { var rateLimiters = new List <IRateLimiter>(); foreach (var rateLimiter in apiOptions.RateLimiters) { rateLimiters.Add(rateLimiter); } RateLimiters = rateLimiters; }
public void SettingLogLevel_Should_RestrictLogging(LogLevel?verbosity, LogLevel testVerbosity, bool expected) { // arrange var logger = new TestStringLogger(); var options = new BaseRestClientOptions() { LogWriters = new List <ILogger> { logger } }; if (verbosity != null) { options.LogLevel = verbosity.Value; } var client = new TestBaseClient(options); // act client.Log(testVerbosity, "Test"); // assert Assert.AreEqual(!string.IsNullOrEmpty(logger.GetLogs()), expected); }
public TestBaseClient(BaseRestClientOptions exchangeOptions) : base("Test", exchangeOptions) { }