< Summary

Information
Class: ArturRios.Util.WebApi.Client.BaseWebApiClient
Assembly: ArturRios.Util.WebApi
File(s): D:\Repositories\dotnet-webapi-util\src\Client\BaseWebApiClient.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 11
Coverable lines: 11
Total lines: 33
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage
0%
Covered methods: 0
Fully covered methods: 0
Total methods: 2
Method coverage: 0%
Full method coverage: 0%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%210%
.ctor(...)100%210%

File(s)

D:\Repositories\dotnet-webapi-util\src\Client\BaseWebApiClient.cs

#LineLine coverage
 1using ArturRios.Util.Http;
 2
 3namespace ArturRios.Util.WebApi.Client;
 4
 5/// <summary>Base class for strongly-typed clients that call a single web API through an <see cref="HttpGateway"/>.</sum
 6public abstract class BaseWebApiClient
 7{
 8    /// <summary>The HTTP gateway used to issue requests to the target API.</summary>
 9    protected readonly HttpGateway Gateway;
 10
 11    /// <summary>Initializes the client from an existing <see cref="HttpClient"/> and lets the derived class configure i
 12    /// <param name="httpClient">The HTTP client to wrap.</param>
 013    protected BaseWebApiClient(HttpClient httpClient)
 014    {
 015        Gateway = new HttpGateway(httpClient);
 16
 017        SetRoutes();
 018    }
 19
 20    /// <summary>Initializes the client with a new <see cref="HttpClient"/> pointed at <paramref name="baseUrl"/> and le
 21    /// <param name="baseUrl">The base address of the target API.</param>
 022    protected BaseWebApiClient(string baseUrl)
 023    {
 024        var httpClient = new HttpClient { BaseAddress = new Uri(baseUrl) };
 25
 026        Gateway = new HttpGateway(httpClient);
 27
 028        SetRoutes();
 029    }
 30
 31    /// <summary>Configures the routes (endpoints) exposed by this client. Called once during construction.</summary>
 32    protected abstract void SetRoutes();
 33}