< Summary

Information
Class: ReportingServices.Shared.HelperClasses.ApiCaller
Assembly: ReportingServices.Shared
File(s): C:\Users\wathen\source\repos\ReportingServices\ReportingServices.Shared\HelperClasses\ApiCaller.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 8
Coverable lines: 8
Total lines: 22
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Method coverage is only available for sponsors.

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
GetApi()100%10%

File(s)

C:\Users\wathen\source\repos\ReportingServices\ReportingServices.Shared\HelperClasses\ApiCaller.cs

#LineLine coverage
 1using ReportingServices.Shared.Models.ProductionReport;
 2using System.Net.Http.Json;
 3using System.Text.Json;
 4
 5namespace ReportingServices.Shared.HelperClasses
 6{
 7    public static class ApiCaller
 8    {
 9        public static async Task<T> GetApi<T>(string url)
 010        {
 11            T deserializedJson;
 12
 013            using (HttpClient client = new())
 014            {
 015                string apiResponse = await client.GetStringAsync(url);
 016                deserializedJson = JsonSerializer.Deserialize<T>(apiResponse);
 017            }
 18
 019            return deserializedJson;
 020        }
 21    }
 22}

Methods/Properties

GetApi()