/// <summary>
 /// Initializes a new instance of the class with an <see cref="ITikkieConfiguration"/> as parameter.
 /// </summary>
 /// <param name="configuration">The Tikkie API configuration</param>
 /// <exception cref="ArgumentNullException">If the parameter is null</exception>
 public AuthorizedRequestsHandler(ITikkieConfiguration configuration)
 {
     _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
     _authenticationRequestsHandler = new AuthenticationRequestsHandler(_configuration);
     AuthorizationTokenInfo         = _authenticationRequestsHandler.AuthorizationTokenInfo;
     _httpClientFactory             = () => new HttpClient();
 }
 /// <summary>
 /// Internal constructor used for unit tests.
 /// Initializes a new instance of the class with an <see cref="ITikkieConfiguration"/>, <see cref="IAuthenticationRequestsHandler"/>
 /// and a factory of <see cref="HttpClient"/> as parameters.
 /// </summary>
 /// <param name="configuration">The Tikkie API configuration</param>
 /// <param name="authenticationRequestsHandler">The authentication requests handler</param>
 /// <param name="httpClientFactory">Factory to inject the HttpClient</param>
 /// <exception cref="ArgumentNullException">If any of the parameters are null</exception>
 internal AuthorizedRequestsHandler(
     ITikkieConfiguration configuration,
     IAuthenticationRequestsHandler authenticationRequestsHandler,
     Func <HttpClient> httpClientFactory)
 {
     _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
     _authenticationRequestsHandler = authenticationRequestsHandler ?? throw new ArgumentNullException(nameof(authenticationRequestsHandler));
     _httpClientFactory             = httpClientFactory ?? throw new ArgumentNullException(nameof(httpClientFactory));
 }
 /// <summary>
 /// Internal constructor used for unit tests.
 /// Initializes a new instance of the class with an <see cref="ITikkieConfiguration"/>, a factory of <see cref="HttpClient"/>
 /// and <see cref="AuthorizationToken"/> as parameters.
 /// </summary>
 /// <param name="configuration">The Tikkie API configuration</param>
 /// <param name="httpClientFactory">Factory to inject the HttpClient</param>
 /// <param name="authorizationToken">Injects an authorization token</param>
 /// <exception cref="ArgumentNullException">If any of the parameters are null</exception>
 internal AuthenticationRequestsHandler(
     ITikkieConfiguration configuration,
     Func <HttpClient> httpClientFactory,
     AuthorizationToken authorizationToken)
 {
     _configuration         = configuration ?? throw new ArgumentNullException(nameof(configuration));
     _httpClientFactory     = httpClientFactory ?? throw new ArgumentNullException(nameof(httpClientFactory));
     AuthorizationTokenInfo = authorizationToken ?? throw new ArgumentNullException(nameof(authorizationToken));
 }
 private AuthenticationRequestsHandler CreateSut(ITikkieConfiguration configuration, Func <HttpClient> httpClientFactory, AuthorizationToken authorizationToken)
 => new AuthenticationRequestsHandler(configuration, httpClientFactory, authorizationToken);
Exemple #5
0
 private AuthorizedRequestsHandler CreateSut(ITikkieConfiguration configuration, IAuthenticationRequestsHandler authenticationRequestsHandler, Func <HttpClient> httpClientFactory)
 => new AuthorizedRequestsHandler(configuration, authenticationRequestsHandler, httpClientFactory);