< Summary

Information
Class: ReportingServices.Shared.Repositories.FabTimeReportingRepository
Assembly: ReportingServices.Shared
File(s): C:\Users\wathen\source\repos\ReportingServices\ReportingServices.Shared\Repositories\Implementations\FabTimeReportingRepository.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 27
Coverable lines: 27
Total lines: 56
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Method coverage is only available for sponsors.

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
.ctor()100%10%
GetMovesTrendData()100%10%
GetToolStateTrendData()100%10%
GetToolStateData()0%20%
GetJsonData()100%10%

File(s)

C:\Users\wathen\source\repos\ReportingServices\ReportingServices.Shared\Repositories\Implementations\FabTimeReportingRepository.cs

#LineLine coverage
 1using ReportingServices.Shared.HelperClasses;
 2using ReportingServices.Shared.Models.ProductionReport;
 3using ReportingServices.Shared.ViewModels.ProductionReport;
 4using System.Text.Json;
 5using System.Web;
 6
 7namespace ReportingServices.Shared.Repositories
 8{
 9    public class FabTimeReportingRepository : IFabTimeReportingRepository
 10    {
 011        private readonly string _toolFilter = "~R76%2C%20~R78%2C%20~R25%2C%20~R67%2C%20~R69%2C%20~R71%2C%20~R47%2C%20~R5
 12
 13        public async Task<List<ReactorOutsByRDS>> GetMovesTrendData(string startDate = "", string endDate = "")
 014        {
 015            string url = APIHelperFunctions.GenerateURLWithParameters(startDate: startDate, endDate: endDate, chart: "MO
 16
 017            return await GetJsonData<List<ReactorOutsByRDS>>(url);
 018        }
 19
 20        public async Task<List<EquipmentStateByDay>> GetToolStateTrendData(string toolType)
 021        {
 022            string url = APIHelperFunctions.GenerateURLWithParameters(chart: "TOOLSTATE", periodLen: "24", capacityTypes
 23
 024            return await GetJsonData<List<EquipmentStateByDay>>(url);
 025        }
 26
 27        public async Task<List<ToolStateCurrent>> GetToolStateData(string toolType)
 028        {
 029            string capacityFilter = toolType == "ASM" ? toolType + "%2CASM%2B" : toolType;
 030            string startDate = HttpUtility.UrlEncode(APIHelperFunctions.GetDateWithOffsetAsAPIString(DateTime.Now.ToStri
 31
 032            string url = APIHelperFunctions.GenerateURLWithParameters(chart: "ToolStateGantt", periodLen: "24",
 033                capacityTypesLike: capacityFilter, toolsLike: _toolFilter, startDate: startDate);
 34
 035            return await GetJsonData<List<ToolStateCurrent>>(url);
 036        }
 37
 38        public async Task<T> GetJsonData<T>(string url)
 039        {
 40            T deserializedJson;
 41
 042            using (var client = new HttpClient())
 043            {
 044                using (HttpResponseMessage response = await client.GetAsync(url))
 045                {
 046                    string apiResponse = await response.Content.ReadAsStringAsync();
 047                    deserializedJson = JsonSerializer.Deserialize<T>(apiResponse);
 048                }
 049            }
 50
 051            return deserializedJson;
 052        }
 53
 54
 55    }
 56}