Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:CSF.Screenplay.WebApis.Abilities.ConsumeWebServices"/> class.
 /// </summary>
 /// <param name="baseUri">The base URI for endpoints which use relative URIs.</param>
 /// <param name="synchronousClientAdapter">Synchronous client adapter.</param>
 /// <param name="defaultTimeout">Default timeout.</param>
 public ConsumeWebServices(Uri baseUri = null,
                           IMakesSynchronousHttpRequests synchronousClientAdapter = null,
                           TimeSpan?defaultTimeout = null)
 {
     this.httpClient = new HttpClient()
     {
         BaseAddress = baseUri
     };
     this.synchronousClientAdapter = synchronousClientAdapter ?? new SynchronousHttpClientAdapter(httpClient, defaultTimeout);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:CSF.Screenplay.WebApis.Abilities.ConsumeWebServices"/> class.
        /// </summary>
        /// <param name="httpClient">Http client.</param>
        /// <param name="synchronousClientAdapter">Synchronous client adapter.</param>
        /// <param name="defaultTimeout">Default timeout.</param>
        public ConsumeWebServices(HttpClient httpClient,
                                  IMakesSynchronousHttpRequests synchronousClientAdapter = null,
                                  TimeSpan?defaultTimeout = null)
        {
            if (httpClient == null)
            {
                throw new ArgumentNullException(nameof(httpClient));
            }

            this.httpClient = httpClient;
            this.synchronousClientAdapter = synchronousClientAdapter ?? new SynchronousHttpClientAdapter(httpClient, defaultTimeout);
        }