From 79efb169a8d1e431bb78a76f2ad528905f614515 Mon Sep 17 00:00:00 2001 From: Petar Hristov <hristov@itc.rwth-aachen.de> Date: Wed, 23 Apr 2025 14:12:56 +0000 Subject: [PATCH] Fix: Remove unused IProjectQuotaApi references from ProjectReporting and ProjectReportingTests --- src/KpiGenerator.Tests/ProjectReportingTests.cs | 16 +++++++--------- .../Reportings/Project/ProjectReporting.cs | 5 +---- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/KpiGenerator.Tests/ProjectReportingTests.cs b/src/KpiGenerator.Tests/ProjectReportingTests.cs index 5cd8eb9..861c6fc 100644 --- a/src/KpiGenerator.Tests/ProjectReportingTests.cs +++ b/src/KpiGenerator.Tests/ProjectReportingTests.cs @@ -26,7 +26,6 @@ public class ProjectReportingTests private IOptionsMonitor<ReportingConfiguration> _reportingConfiguration = null!; private IAdminApi _adminApi = null!; - private IProjectQuotaApi _projectQuotaApi = null!; private ProjectReporting _projectReporting = null!; // System Under Test @@ -69,9 +68,8 @@ public class ProjectReportingTests }; _reportingConfiguration = Substitute.For<IOptionsMonitor<ReportingConfiguration>>(); _reportingConfiguration.CurrentValue.Returns(reportingConfig); - + _adminApi = Substitute.For<IAdminApi>(); - _projectQuotaApi = Substitute.For<ProjectQuotaApi>(); } #region GenerateReportingAsync Tests @@ -96,7 +94,7 @@ public class ProjectReportingTests var pagination = new Pagination(currentPage: 1, pageSize: 2, totalCount: 2, totalPages: 1); return Task.FromResult(new ProjectAdminDtoPagedResponse(data: projects, pagination: pagination, statusCode: 200, traceId: "dummy-trace-id")); }); - _projectReporting = new ProjectReporting(_mapper, _logger, _gitlabStorageService, _localStorageService, _kpiConfiguration, _reportingConfiguration, _adminApi, _projectQuotaApi); + _projectReporting = new ProjectReporting(_mapper, _logger, _gitlabStorageService, _localStorageService, _kpiConfiguration, _reportingConfiguration, _adminApi); // Act var result = await _projectReporting.GenerateReportingAsync(); @@ -128,7 +126,7 @@ public class ProjectReportingTests var pagination = new Pagination(currentPage: 1, pageSize: 0, totalCount: 0, totalPages: 1); return Task.FromResult(new ProjectAdminDtoPagedResponse(data: [], pagination: pagination, statusCode: 200, traceId: "dummy-trace-id")); }); - _projectReporting = new ProjectReporting(_mapper, _logger, _gitlabStorageService, _localStorageService, _kpiConfiguration, _reportingConfiguration, _adminApi, _projectQuotaApi); + _projectReporting = new ProjectReporting(_mapper, _logger, _gitlabStorageService, _localStorageService, _kpiConfiguration, _reportingConfiguration, _adminApi); // Act var result = await _projectReporting.GenerateReportingAsync(); @@ -155,7 +153,7 @@ public class ProjectReportingTests }; // We want to ensure that GenerateReportingAsync returns some test objects - _projectReporting = Substitute.ForPartsOf<ProjectReporting>(_mapper, _logger, _gitlabStorageService, _localStorageService, _kpiConfiguration, _reportingConfiguration, _adminApi, _projectQuotaApi); + _projectReporting = Substitute.ForPartsOf<ProjectReporting>(_mapper, _logger, _gitlabStorageService, _localStorageService, _kpiConfiguration, _reportingConfiguration, _adminApi); _projectReporting .Configure() .GenerateReportingAsync() @@ -195,7 +193,7 @@ public class ProjectReportingTests }; // Partial mock to override GenerateReportingAsync - _projectReporting = Substitute.ForPartsOf<ProjectReporting>(_mapper, _logger, _gitlabStorageService, _localStorageService, _kpiConfiguration, _reportingConfiguration, _adminApi, _projectQuotaApi); + _projectReporting = Substitute.ForPartsOf<ProjectReporting>(_mapper, _logger, _gitlabStorageService, _localStorageService, _kpiConfiguration, _reportingConfiguration, _adminApi); _projectReporting .Configure() .GenerateReportingAsync() @@ -235,7 +233,7 @@ public class ProjectReportingTests }; // Partial mock to override GenerateReportingAsync - _projectReporting = Substitute.ForPartsOf<ProjectReporting>(_mapper, _logger, _gitlabStorageService, _localStorageService, _kpiConfiguration, _reportingConfiguration, _adminApi, _projectQuotaApi); + _projectReporting = Substitute.ForPartsOf<ProjectReporting>(_mapper, _logger, _gitlabStorageService, _localStorageService, _kpiConfiguration, _reportingConfiguration, _adminApi); _projectReporting .Configure() .GenerateReportingAsync() @@ -272,7 +270,7 @@ public class ProjectReportingTests }; // Partial mock - _projectReporting = Substitute.ForPartsOf<ProjectReporting>(_mapper, _logger, _gitlabStorageService, _localStorageService, _kpiConfiguration, _reportingConfiguration, _adminApi, _projectQuotaApi); + _projectReporting = Substitute.ForPartsOf<ProjectReporting>(_mapper, _logger, _gitlabStorageService, _localStorageService, _kpiConfiguration, _reportingConfiguration, _adminApi); _projectReporting .Configure() .GenerateReportingAsync() diff --git a/src/KpiGenerator/Reportings/Project/ProjectReporting.cs b/src/KpiGenerator/Reportings/Project/ProjectReporting.cs index ba8d846..e8bee5e 100644 --- a/src/KpiGenerator/Reportings/Project/ProjectReporting.cs +++ b/src/KpiGenerator/Reportings/Project/ProjectReporting.cs @@ -22,7 +22,6 @@ public class ProjectReporting private readonly KpiConfiguration _kpiConfiguration; private readonly ReportingConfiguration _reportingConfiguration; private readonly IAdminApi _adminApi; - private readonly IProjectQuotaApi _projectQuotaApi; public ProjectReportingOptions Options { get; private set; } = null!; public string ReportingFileName { get; } @@ -34,8 +33,7 @@ public class ProjectReporting [FromKeyedServices("local")] IStorageService localStorageService, IOptionsMonitor<KpiConfiguration> kpiConfiguration, IOptionsMonitor<ReportingConfiguration> reportingConfiguration, - IAdminApi adminApi, - IProjectQuotaApi projectQuotaApi + IAdminApi adminApi ) { _mapper = mapper; @@ -47,7 +45,6 @@ public class ProjectReporting ReportingFileName = _kpiConfiguration.ProjectKpi.FileName; _adminApi = adminApi; - _projectQuotaApi = projectQuotaApi; } public async Task<bool> RunAsync(ProjectReportingOptions reportingOptions) -- GitLab