From c96f8dc1b9604a4f0bf2ca822dbdf5c683752b70 Mon Sep 17 00:00:00 2001
From: grant-dot-dev <12433404+grant-dot-dev@users.noreply.github.com>
Date: Tue, 18 Feb 2025 10:58:04 +0000
Subject: [PATCH 1/3] Upgrade to .Net 8 & add test coverage
---
.github/workflows/continuous-integration.yml | 4 +-
.gitignore | 6 +-
README.md | 57 +-
source/.gitignore | 3 +-
source/.runsettings | 26 +
source/Core.Tests/.gitignore | 264 ++++++
source/Core.Tests/Core.Tests.csproj | 38 +
.../Helpers/ApplicationHelperTests.cs | 104 +++
.../Helpers/AttributeExtensionsTests.cs | 87 ++
.../Helpers/ConnectionStringsTests.cs | 20 +
.../Helpers/DateFormatConstantsTests.cs | 19 +
.../Core.Tests/Helpers/DateTimeHelperTests.cs | 59 ++
source/Core.Tests/Helpers/FilePathTests.cs | 47 +
.../Core.Tests/Services/DataServiceTests.cs | 209 +++++
source/Core/.gitignore | 265 ++++++
source/Core/Core.csproj | 23 +
source/Core/DTOs/AppConfiguration.cs | 7 +
.../DTOs}/Request/AsidLookup.cs | 4 +-
source/Core/DTOs/Request/AsidLookupRun.cs | 6 +
.../DTOs}/Request/BaseRun.cs | 6 +-
.../DTOs}/Request/File.cs | 4 +-
.../Request/OrganisationHeirarchyProvider.cs | 15 +
.../DTOs}/Request/RequestUri.cs | 6 +-
.../DTOs}/Request/SspTransaction.cs | 4 +-
.../DTOs}/Request/SspTransactionRun.cs | 6 +-
.../Response/Configuration/BlobStorage.cs | 4 +-
.../DTOs}/Response/Configuration/Email.cs | 4 +-
.../Configuration/FilePathConstants.cs | 4 +-
.../DTOs}/Response/Configuration/FileType.cs | 6 +-
.../Response/Configuration/SplunkClient.cs | 4 +-
.../Response/Configuration/SplunkInstance.cs | 4 +-
.../DTOs}/Response/Queue/Message.cs | 4 +-
.../DTOs}/Response/Splunk/Extract.cs | 6 +-
.../DTOs}/Response/Splunk/ExtractResponse.cs | 8 +-
source/Core/Helpers/ApplicationHelper.cs | 23 +
source/Core/Helpers/AttributeExtensions.cs | 27 +
.../Helpers}/ConnectionStrings.cs | 6 +-
.../Helpers}/DateFormatConstants.cs | 6 +-
.../Helpers}/DateTimeHelper.cs | 5 +-
.../Helpers}/FilePath.cs | 8 +-
source/Core/Helpers/FileTypes.cs | 9 +
.../Helpers}/SplunkInstance.cs | 4 +-
source/Core/Helpers/TimeProvider.cs | 9 +
source/Core/IConnectionFactory.cs | 8 +
source/Core/ITimeProvider.cs | 16 +
.../Mapping/SplunkInstanceMap.cs | 6 +-
source/Core/Repositories/DapperWrapper.cs | 68 ++
.../HierarchyProviderConsumerRepo.cs | 66 ++
.../IHierarchyProviderConsumerRepo.cs | 8 +
.../Interfaces/IConfigurationService.cs | 10 +-
.../Services/Interfaces/ICoreConfiguration.cs | 6 +
.../Core/Services/Interfaces/IDataService.cs | 15 +
source/Functions.Tests/FilePathHelperTests.cs | 121 +++
source/Functions.Tests/Functions.Tests.csproj | 31 +
.../Functions.Tests.csproj.DotSettings | 2 +
.../Functions/ExecuteImportByTriggerTests.cs | 57 ++
.../GetDataFromApiByDateRangeTests.cs | 164 ++++
.../Functions/GetDataFromApiManualTests.cs | 104 +++
.../Functions/GetDataFromApiTodayTests.cs | 234 +++++
.../GetDataFromApiTodayTimerTests.cs | 67 ++
.../Functions/PurgeErrorLogByTriggerTests.cs | 33 +
.../StoreProviderConsumerDataTests.cs | 146 +++
.../HttpClientExtensionsTests.cs | 39 +
source/Functions.Tests/LoggingServiceTests.cs | 33 +
source/Functions.Tests/RequestWrappers.cs | 42 +
.../Services/BatchServiceTests.cs | 277 ++++++
.../Services/BlobServiceTests.cs | 326 +++++++
.../Services/ConfigurationServiceTests.cs | 255 ++++++
.../Services/CoreConfigurationServiceTests.cs | 56 ++
.../Services/FileServiceTests.cs | 29 +
.../Services/ImportServiceTests.cs | 315 +++++++
.../Services/SplunkServicesTests.cs | 294 ++++++
.../TestHelpers/ConfigurationHelpers.cs | 30 +
.../TestHelpers/MockRequests.cs | 56 ++
.../TestHelpers/MockTriggers.cs | 14 +
.../.gitignore | 0
.../EmailConfigurationProvider.cs | 29 +
.../HttpClient/HttpClientExtensions.cs | 23 +
.../Logging/LoggingExtensions.cs | 87 +-
.../Mapping/MappingExtensions.cs | 13 +
.../Dockerfile | 0
source/Functions/ExecuteImportByTrigger.cs | 16 +
source/Functions/Functions.csproj | 39 +
source/Functions/GetDataFromApiByDateRange.cs | 85 ++
source/Functions/GetDataFromApiByTrigger.cs | 34 +
source/Functions/GetDataFromApiManual.cs | 42 +
source/Functions/GetDataFromApiToday.cs | 98 ++
.../Functions/HelperClasses/FilePathHelper.cs | 54 ++
source/Functions/Program.cs | 54 ++
.../Properties/launchSettings.json | 0
source/Functions/PurgeErrorLogByTrigger.cs | 16 +
source/Functions/Services/BatchService.cs | 146 +++
.../Services}/BlobService.cs | 59 +-
.../Services/ConfigurationService.cs | 61 ++
.../Services/CoreConfigurationService.cs | 14 +
source/Functions/Services/DataService.cs | 113 +++
source/Functions/Services/FileService.cs | 19 +
source/Functions/Services/ImportService.cs | 84 ++
.../Services/Interfaces/IBatchService.cs | 14 +
.../Services/Interfaces/IBlobService.cs | 11 +
.../Services/Interfaces/IFileService.cs | 6 +
.../Services/Interfaces/IImportService.cs | 13 +
.../Services}/Interfaces/ILoggingService.cs | 6 +-
.../Services/Interfaces/ISplunkService.cs | 12 +
.../Services}/LoggingService.cs | 8 +-
.../Services}/SplunkService.cs | 115 +--
source/Functions/SqlConnectionFactory.cs | 13 +
source/Functions/StoreProviderConsumerData.cs | 68 ++
.../host.json | 5 -
source/Functions/nlog.config.xml | 15 +
.../DapperTestSetupFixture.cs | 74 ++
.../DapperWrapperIntegrationTests.cs | 147 +++
.../EmailConfigurationProviderTests.cs | 131 +++
.../HierarchyProviderConsumerRepoTests.cs | 119 +++
.../IntegrationTests/IntegrationTests.csproj | 51 ++
.../IntegrationTests/MsSqlContainerFixture.cs | 77 ++
.../TestHelpers/ConfigurationHelpers.cs | 25 +
source/coverage/Core_ApplicationHelper.html | 198 +++++
source/coverage/Core_AttributeExtensions.html | 202 +++++
source/coverage/Core_ConnectionStrings.html | 180 ++++
source/coverage/Core_DapperWrapper.html | 247 ++++++
source/coverage/Core_DateTimeHelper.html | 184 ++++
source/coverage/Core_FilePathAttribute.html | 185 ++++
.../Core_HierarchyProviderConsumerRepo.html | 235 +++++
.../Core_OrganisationHierarchyProvider.html | 192 ++++
source/coverage/Core_SplunkInstanceMap.html | 187 ++++
source/coverage/Core_TimeProvider.html | 187 ++++
source/coverage/Functions_BatchService.html | 327 +++++++
source/coverage/Functions_BlobService.html | 270 ++++++
.../Functions_ConfigurationService.html | 244 +++++
.../Functions_CoreConfigurationService.html | 187 ++++
source/coverage/Functions_DataService.html | 296 +++++++
.../Functions_DirectFunctionExecutor.html | 169 ++++
.../Functions_EmailConfigurationProvider.html | 202 +++++
.../Functions_ExecuteImportByTrigger.html | 189 ++++
source/coverage/Functions_FileService.html | 192 ++++
...Functions_FunctionExecutorAutoStartup.html | 167 ++++
...FunctionExecutorHostBuilderExtensions.html | 167 ++++
...s_FunctionMetadataProviderAutoStartup.html | 167 ++++
...ons_GeneratedFunctionMetadataProvider.html | 167 ++++
.../Functions_GetDataFromApiByDateRange.html | 262 ++++++
.../Functions_GetDataFromApiByTrigger.html | 211 +++++
.../Functions_GetDataFromApiManual.html | 215 +++++
.../Functions_GetDataFromApiToday.html | 275 ++++++
.../Functions_HttpClientExtensions.html | 198 +++++
source/coverage/Functions_ImportService.html | 261 ++++++
.../coverage/Functions_LoggingExtensions.html | 368 ++++++++
source/coverage/Functions_LoggingService.html | 196 ++++
.../coverage/Functions_MappingExtensions.html | 186 ++++
source/coverage/Functions_Program.html | 227 +++++
.../Functions_PurgeErrorLogByTrigger.html | 189 ++++
source/coverage/Functions_SplunkService.html | 366 ++++++++
.../Functions_SqlConnectionFactory.html | 186 ++++
.../Functions_StoreProviderConsumerData.html | 242 +++++
...ns_WorkerExtensionStartupCodeExecutor.html | 167 ++++
...lderFunctionMetadataProviderExtension.html | 167 ++++
source/coverage/class.js | 218 +++++
source/coverage/icon_cog.svg | 1 +
source/coverage/icon_cog_dark.svg | 1 +
source/coverage/icon_cube.svg | 2 +
source/coverage/icon_cube_dark.svg | 1 +
source/coverage/icon_fork.svg | 2 +
source/coverage/icon_fork_dark.svg | 1 +
source/coverage/icon_info-circled.svg | 2 +
source/coverage/icon_info-circled_dark.svg | 2 +
source/coverage/icon_minus.svg | 2 +
source/coverage/icon_minus_dark.svg | 1 +
source/coverage/icon_plus.svg | 2 +
source/coverage/icon_plus_dark.svg | 1 +
source/coverage/icon_search-minus.svg | 2 +
source/coverage/icon_search-minus_dark.svg | 1 +
source/coverage/icon_search-plus.svg | 2 +
source/coverage/icon_search-plus_dark.svg | 1 +
source/coverage/icon_sponsor.svg | 2 +
source/coverage/icon_star.svg | 2 +
source/coverage/icon_star_dark.svg | 2 +
source/coverage/icon_up-dir.svg | 2 +
source/coverage/icon_up-dir_active.svg | 2 +
source/coverage/icon_up-down-dir.svg | 2 +
source/coverage/icon_up-down-dir_dark.svg | 2 +
source/coverage/icon_wrench.svg | 2 +
source/coverage/icon_wrench_dark.svg | 1 +
source/coverage/index.htm | 234 +++++
source/coverage/index.html | 234 +++++
source/coverage/main.js | 334 +++++++
source/coverage/report.css | 834 ++++++++++++++++++
source/global.json | 5 +
.../gpconnect-analytics.DAL/BatchService.cs | 161 ----
.../ConfigurationService.cs | 63 --
source/gpconnect-analytics.DAL/DataService.cs | 88 --
.../gpconnect-analytics.DAL/ImportService.cs | 101 ---
.../Interfaces/IBatchService.cs | 19 -
.../Interfaces/IBlobService.cs | 12 -
.../Interfaces/IDataService.cs | 13 -
.../Interfaces/IImportService.cs | 17 -
.../Interfaces/ISplunkService.cs | 12 -
.../gpconnect-analytics.DAL.csproj | 29 -
.../Request/AsidLookupRun.cs | 6 -
.../Response/Import/NextFile.cs | 7 -
.../gpconnect-analytics.DTO.csproj | 13 -
.../HttpClient/HttpClientExtensions.cs | 27 -
.../Mapping/MappingExtensions.cs | 16 -
.../ExecuteImportByTrigger.cs | 24 -
.../GetDataFromApiByDateRange.cs | 39 -
.../GetDataFromApiByTrigger.cs | 36 -
.../GetDataFromApiManual.cs | 26 -
.../GetDataFromApiToday.cs | 39 -
.../PurgeErrorLogByTrigger.cs | 23 -
.../gpconnect-analytics.Functions/Startup.cs | 31 -
.../gpconnect-analytics.Functions.csproj | 32 -
.../ApplicationHelper.cs | 20 -
.../AttributeExtensions.cs | 21 -
.../ConfigurationHelper.cs | 15 -
.../gpconnect-analytics.Helpers/FileTypes.cs | 12 -
.../NumberExtensions.cs | 23 -
.../StringExtensions.cs | 13 -
.../gpconnect-analytics.Helpers.csproj | 12 -
source/gpconnect-analytics.sln | 38 +-
source/gpconnect-analytics.sln.DotSettings | 16 +
219 files changed, 16537 insertions(+), 1178 deletions(-)
create mode 100644 source/.runsettings
create mode 100644 source/Core.Tests/.gitignore
create mode 100644 source/Core.Tests/Core.Tests.csproj
create mode 100644 source/Core.Tests/Helpers/ApplicationHelperTests.cs
create mode 100644 source/Core.Tests/Helpers/AttributeExtensionsTests.cs
create mode 100644 source/Core.Tests/Helpers/ConnectionStringsTests.cs
create mode 100644 source/Core.Tests/Helpers/DateFormatConstantsTests.cs
create mode 100644 source/Core.Tests/Helpers/DateTimeHelperTests.cs
create mode 100644 source/Core.Tests/Helpers/FilePathTests.cs
create mode 100644 source/Core.Tests/Services/DataServiceTests.cs
create mode 100644 source/Core/.gitignore
create mode 100644 source/Core/Core.csproj
create mode 100644 source/Core/DTOs/AppConfiguration.cs
rename source/{gpconnect-analytics.DTO => Core/DTOs}/Request/AsidLookup.cs (87%)
create mode 100644 source/Core/DTOs/Request/AsidLookupRun.cs
rename source/{gpconnect-analytics.DTO => Core/DTOs}/Request/BaseRun.cs (86%)
rename source/{gpconnect-analytics.DTO => Core/DTOs}/Request/File.cs (72%)
create mode 100644 source/Core/DTOs/Request/OrganisationHeirarchyProvider.cs
rename source/{gpconnect-analytics.DTO => Core/DTOs}/Request/RequestUri.cs (78%)
rename source/{gpconnect-analytics.DTO => Core/DTOs}/Request/SspTransaction.cs (91%)
rename source/{gpconnect-analytics.DTO => Core/DTOs}/Request/SspTransactionRun.cs (72%)
rename source/{gpconnect-analytics.DTO => Core/DTOs}/Response/Configuration/BlobStorage.cs (83%)
rename source/{gpconnect-analytics.DTO => Core/DTOs}/Response/Configuration/Email.cs (88%)
rename source/{gpconnect-analytics.DTO => Core/DTOs}/Response/Configuration/FilePathConstants.cs (83%)
rename source/{gpconnect-analytics.DTO => Core/DTOs}/Response/Configuration/FileType.cs (84%)
rename source/{gpconnect-analytics.DTO => Core/DTOs}/Response/Configuration/SplunkClient.cs (85%)
rename source/{gpconnect-analytics.DTO => Core/DTOs}/Response/Configuration/SplunkInstance.cs (68%)
rename source/{gpconnect-analytics.DTO => Core/DTOs}/Response/Queue/Message.cs (76%)
rename source/{gpconnect-analytics.DTO => Core/DTOs}/Response/Splunk/Extract.cs (80%)
rename source/{gpconnect-analytics.DTO => Core/DTOs}/Response/Splunk/ExtractResponse.cs (71%)
create mode 100644 source/Core/Helpers/ApplicationHelper.cs
create mode 100644 source/Core/Helpers/AttributeExtensions.cs
rename source/{gpconnect-analytics.DAL => Core/Helpers}/ConnectionStrings.cs (65%)
rename source/{gpconnect-analytics.Helpers => Core/Helpers}/DateFormatConstants.cs (82%)
rename source/{gpconnect-analytics.Helpers => Core/Helpers}/DateTimeHelper.cs (74%)
rename source/{gpconnect-analytics.Helpers => Core/Helpers}/FilePath.cs (57%)
create mode 100644 source/Core/Helpers/FileTypes.cs
rename source/{gpconnect-analytics.Helpers => Core/Helpers}/SplunkInstance.cs (68%)
create mode 100644 source/Core/Helpers/TimeProvider.cs
create mode 100644 source/Core/IConnectionFactory.cs
create mode 100644 source/Core/ITimeProvider.cs
rename source/{gpconnect-analytics.DAL => Core}/Mapping/SplunkInstanceMap.cs (74%)
create mode 100644 source/Core/Repositories/DapperWrapper.cs
create mode 100644 source/Core/Repositories/HierarchyProviderConsumerRepo.cs
create mode 100644 source/Core/Repositories/IHierarchyProviderConsumerRepo.cs
rename source/{gpconnect-analytics.DAL => Core/Services}/Interfaces/IConfigurationService.cs (66%)
create mode 100644 source/Core/Services/Interfaces/ICoreConfiguration.cs
create mode 100644 source/Core/Services/Interfaces/IDataService.cs
create mode 100644 source/Functions.Tests/FilePathHelperTests.cs
create mode 100644 source/Functions.Tests/Functions.Tests.csproj
create mode 100644 source/Functions.Tests/Functions.Tests.csproj.DotSettings
create mode 100644 source/Functions.Tests/Functions/ExecuteImportByTriggerTests.cs
create mode 100644 source/Functions.Tests/Functions/GetDataFromApiByDateRangeTests.cs
create mode 100644 source/Functions.Tests/Functions/GetDataFromApiManualTests.cs
create mode 100644 source/Functions.Tests/Functions/GetDataFromApiTodayTests.cs
create mode 100644 source/Functions.Tests/Functions/GetDataFromApiTodayTimerTests.cs
create mode 100644 source/Functions.Tests/Functions/PurgeErrorLogByTriggerTests.cs
create mode 100644 source/Functions.Tests/Functions/StoreProviderConsumerDataTests.cs
create mode 100644 source/Functions.Tests/HttpClientExtensionsTests.cs
create mode 100644 source/Functions.Tests/LoggingServiceTests.cs
create mode 100644 source/Functions.Tests/RequestWrappers.cs
create mode 100644 source/Functions.Tests/Services/BatchServiceTests.cs
create mode 100644 source/Functions.Tests/Services/BlobServiceTests.cs
create mode 100644 source/Functions.Tests/Services/ConfigurationServiceTests.cs
create mode 100644 source/Functions.Tests/Services/CoreConfigurationServiceTests.cs
create mode 100644 source/Functions.Tests/Services/FileServiceTests.cs
create mode 100644 source/Functions.Tests/Services/ImportServiceTests.cs
create mode 100644 source/Functions.Tests/Services/SplunkServicesTests.cs
create mode 100644 source/Functions.Tests/TestHelpers/ConfigurationHelpers.cs
create mode 100644 source/Functions.Tests/TestHelpers/MockRequests.cs
create mode 100644 source/Functions.Tests/TestHelpers/MockTriggers.cs
rename source/{gpconnect-analytics.Functions => Functions}/.gitignore (100%)
create mode 100644 source/Functions/Configuration/EmailConfigurationProvider.cs
create mode 100644 source/Functions/Configuration/Infrastructure/HttpClient/HttpClientExtensions.cs
rename source/{gpconnect-analytics.Functions => Functions}/Configuration/Infrastructure/Logging/LoggingExtensions.cs (69%)
create mode 100644 source/Functions/Configuration/Infrastructure/Mapping/MappingExtensions.cs
rename source/{gpconnect-analytics.Functions => Functions}/Dockerfile (100%)
create mode 100644 source/Functions/ExecuteImportByTrigger.cs
create mode 100644 source/Functions/Functions.csproj
create mode 100644 source/Functions/GetDataFromApiByDateRange.cs
create mode 100644 source/Functions/GetDataFromApiByTrigger.cs
create mode 100644 source/Functions/GetDataFromApiManual.cs
create mode 100644 source/Functions/GetDataFromApiToday.cs
create mode 100644 source/Functions/HelperClasses/FilePathHelper.cs
create mode 100644 source/Functions/Program.cs
rename source/{gpconnect-analytics.Functions => Functions}/Properties/launchSettings.json (100%)
create mode 100644 source/Functions/PurgeErrorLogByTrigger.cs
create mode 100644 source/Functions/Services/BatchService.cs
rename source/{gpconnect-analytics.DAL => Functions/Services}/BlobService.cs (56%)
create mode 100644 source/Functions/Services/ConfigurationService.cs
create mode 100644 source/Functions/Services/CoreConfigurationService.cs
create mode 100644 source/Functions/Services/DataService.cs
create mode 100644 source/Functions/Services/FileService.cs
create mode 100644 source/Functions/Services/ImportService.cs
create mode 100644 source/Functions/Services/Interfaces/IBatchService.cs
create mode 100644 source/Functions/Services/Interfaces/IBlobService.cs
create mode 100644 source/Functions/Services/Interfaces/IFileService.cs
create mode 100644 source/Functions/Services/Interfaces/IImportService.cs
rename source/{gpconnect-analytics.DAL => Functions/Services}/Interfaces/ILoggingService.cs (50%)
create mode 100644 source/Functions/Services/Interfaces/ISplunkService.cs
rename source/{gpconnect-analytics.DAL => Functions/Services}/LoggingService.cs (79%)
rename source/{gpconnect-analytics.DAL => Functions/Services}/SplunkService.cs (55%)
create mode 100644 source/Functions/SqlConnectionFactory.cs
create mode 100644 source/Functions/StoreProviderConsumerData.cs
rename source/{gpconnect-analytics.Functions => Functions}/host.json (61%)
create mode 100644 source/Functions/nlog.config.xml
create mode 100644 source/IntegrationTests/DapperTestSetupFixture.cs
create mode 100644 source/IntegrationTests/DapperWrapperIntegrationTests.cs
create mode 100644 source/IntegrationTests/EmailConfigurationProviderTests.cs
create mode 100644 source/IntegrationTests/HierarchyProviderConsumerRepoTests.cs
create mode 100644 source/IntegrationTests/IntegrationTests.csproj
create mode 100644 source/IntegrationTests/MsSqlContainerFixture.cs
create mode 100644 source/IntegrationTests/TestHelpers/ConfigurationHelpers.cs
create mode 100644 source/coverage/Core_ApplicationHelper.html
create mode 100644 source/coverage/Core_AttributeExtensions.html
create mode 100644 source/coverage/Core_ConnectionStrings.html
create mode 100644 source/coverage/Core_DapperWrapper.html
create mode 100644 source/coverage/Core_DateTimeHelper.html
create mode 100644 source/coverage/Core_FilePathAttribute.html
create mode 100644 source/coverage/Core_HierarchyProviderConsumerRepo.html
create mode 100644 source/coverage/Core_OrganisationHierarchyProvider.html
create mode 100644 source/coverage/Core_SplunkInstanceMap.html
create mode 100644 source/coverage/Core_TimeProvider.html
create mode 100644 source/coverage/Functions_BatchService.html
create mode 100644 source/coverage/Functions_BlobService.html
create mode 100644 source/coverage/Functions_ConfigurationService.html
create mode 100644 source/coverage/Functions_CoreConfigurationService.html
create mode 100644 source/coverage/Functions_DataService.html
create mode 100644 source/coverage/Functions_DirectFunctionExecutor.html
create mode 100644 source/coverage/Functions_EmailConfigurationProvider.html
create mode 100644 source/coverage/Functions_ExecuteImportByTrigger.html
create mode 100644 source/coverage/Functions_FileService.html
create mode 100644 source/coverage/Functions_FunctionExecutorAutoStartup.html
create mode 100644 source/coverage/Functions_FunctionExecutorHostBuilderExtensions.html
create mode 100644 source/coverage/Functions_FunctionMetadataProviderAutoStartup.html
create mode 100644 source/coverage/Functions_GeneratedFunctionMetadataProvider.html
create mode 100644 source/coverage/Functions_GetDataFromApiByDateRange.html
create mode 100644 source/coverage/Functions_GetDataFromApiByTrigger.html
create mode 100644 source/coverage/Functions_GetDataFromApiManual.html
create mode 100644 source/coverage/Functions_GetDataFromApiToday.html
create mode 100644 source/coverage/Functions_HttpClientExtensions.html
create mode 100644 source/coverage/Functions_ImportService.html
create mode 100644 source/coverage/Functions_LoggingExtensions.html
create mode 100644 source/coverage/Functions_LoggingService.html
create mode 100644 source/coverage/Functions_MappingExtensions.html
create mode 100644 source/coverage/Functions_Program.html
create mode 100644 source/coverage/Functions_PurgeErrorLogByTrigger.html
create mode 100644 source/coverage/Functions_SplunkService.html
create mode 100644 source/coverage/Functions_SqlConnectionFactory.html
create mode 100644 source/coverage/Functions_StoreProviderConsumerData.html
create mode 100644 source/coverage/Functions_WorkerExtensionStartupCodeExecutor.html
create mode 100644 source/coverage/Functions_WorkerHostBuilderFunctionMetadataProviderExtension.html
create mode 100644 source/coverage/class.js
create mode 100644 source/coverage/icon_cog.svg
create mode 100644 source/coverage/icon_cog_dark.svg
create mode 100644 source/coverage/icon_cube.svg
create mode 100644 source/coverage/icon_cube_dark.svg
create mode 100644 source/coverage/icon_fork.svg
create mode 100644 source/coverage/icon_fork_dark.svg
create mode 100644 source/coverage/icon_info-circled.svg
create mode 100644 source/coverage/icon_info-circled_dark.svg
create mode 100644 source/coverage/icon_minus.svg
create mode 100644 source/coverage/icon_minus_dark.svg
create mode 100644 source/coverage/icon_plus.svg
create mode 100644 source/coverage/icon_plus_dark.svg
create mode 100644 source/coverage/icon_search-minus.svg
create mode 100644 source/coverage/icon_search-minus_dark.svg
create mode 100644 source/coverage/icon_search-plus.svg
create mode 100644 source/coverage/icon_search-plus_dark.svg
create mode 100644 source/coverage/icon_sponsor.svg
create mode 100644 source/coverage/icon_star.svg
create mode 100644 source/coverage/icon_star_dark.svg
create mode 100644 source/coverage/icon_up-dir.svg
create mode 100644 source/coverage/icon_up-dir_active.svg
create mode 100644 source/coverage/icon_up-down-dir.svg
create mode 100644 source/coverage/icon_up-down-dir_dark.svg
create mode 100644 source/coverage/icon_wrench.svg
create mode 100644 source/coverage/icon_wrench_dark.svg
create mode 100644 source/coverage/index.htm
create mode 100644 source/coverage/index.html
create mode 100644 source/coverage/main.js
create mode 100644 source/coverage/report.css
create mode 100644 source/global.json
delete mode 100644 source/gpconnect-analytics.DAL/BatchService.cs
delete mode 100644 source/gpconnect-analytics.DAL/ConfigurationService.cs
delete mode 100644 source/gpconnect-analytics.DAL/DataService.cs
delete mode 100644 source/gpconnect-analytics.DAL/ImportService.cs
delete mode 100644 source/gpconnect-analytics.DAL/Interfaces/IBatchService.cs
delete mode 100644 source/gpconnect-analytics.DAL/Interfaces/IBlobService.cs
delete mode 100644 source/gpconnect-analytics.DAL/Interfaces/IDataService.cs
delete mode 100644 source/gpconnect-analytics.DAL/Interfaces/IImportService.cs
delete mode 100644 source/gpconnect-analytics.DAL/Interfaces/ISplunkService.cs
delete mode 100644 source/gpconnect-analytics.DAL/gpconnect-analytics.DAL.csproj
delete mode 100644 source/gpconnect-analytics.DTO/Request/AsidLookupRun.cs
delete mode 100644 source/gpconnect-analytics.DTO/Response/Import/NextFile.cs
delete mode 100644 source/gpconnect-analytics.DTO/gpconnect-analytics.DTO.csproj
delete mode 100644 source/gpconnect-analytics.Functions/Configuration/Infrastructure/HttpClient/HttpClientExtensions.cs
delete mode 100644 source/gpconnect-analytics.Functions/Configuration/Infrastructure/Mapping/MappingExtensions.cs
delete mode 100644 source/gpconnect-analytics.Functions/ExecuteImportByTrigger.cs
delete mode 100644 source/gpconnect-analytics.Functions/GetDataFromApiByDateRange.cs
delete mode 100644 source/gpconnect-analytics.Functions/GetDataFromApiByTrigger.cs
delete mode 100644 source/gpconnect-analytics.Functions/GetDataFromApiManual.cs
delete mode 100644 source/gpconnect-analytics.Functions/GetDataFromApiToday.cs
delete mode 100644 source/gpconnect-analytics.Functions/PurgeErrorLogByTrigger.cs
delete mode 100644 source/gpconnect-analytics.Functions/Startup.cs
delete mode 100644 source/gpconnect-analytics.Functions/gpconnect-analytics.Functions.csproj
delete mode 100644 source/gpconnect-analytics.Helpers/ApplicationHelper.cs
delete mode 100644 source/gpconnect-analytics.Helpers/AttributeExtensions.cs
delete mode 100644 source/gpconnect-analytics.Helpers/ConfigurationHelper.cs
delete mode 100644 source/gpconnect-analytics.Helpers/FileTypes.cs
delete mode 100644 source/gpconnect-analytics.Helpers/NumberExtensions.cs
delete mode 100644 source/gpconnect-analytics.Helpers/StringExtensions.cs
delete mode 100644 source/gpconnect-analytics.Helpers/gpconnect-analytics.Helpers.csproj
create mode 100644 source/gpconnect-analytics.sln.DotSettings
diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml
index 25c730e..7fa3c31 100644
--- a/.github/workflows/continuous-integration.yml
+++ b/.github/workflows/continuous-integration.yml
@@ -25,8 +25,8 @@ jobs:
- name: Set up dotnet
uses: actions/setup-dotnet@v1
with:
- dotnet-version: '3.1.x'
-
+ dotnet-version: '8.0.x'
+
- name: Build dotnet solution
run: dotnet build source/gpconnect-analytics.sln
diff --git a/.gitignore b/.gitignore
index 7dbaf57..7b4683f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,8 +4,12 @@
.vs
*.ps1
+.vscode
+**/CoverageReport/
+**/TestResults/
database/flyway-7.0.0/
serviceDependencies.json
serviceDependencies.local.json
*.arm.json
-/source/gpconnect-analytics.Functions/Properties/PublishProfiles/GPConnectAnalytics - Zip Deploy.pubxml
+/source/gpconnect-analytics.Functions/Properties/PublishProfiles/GPConnectAnalytics - Zip Deploy.pubxml.DS_Store
+.DS_Store
\ No newline at end of file
diff --git a/README.md b/README.md
index 579c36a..fea345c 100644
--- a/README.md
+++ b/README.md
@@ -7,6 +7,7 @@
[](https://github.com/nhsconnect/gpconnect-analytics/actions?)
## End-to-end data flow
+

## Data extracts
@@ -41,13 +42,13 @@ General format:
`PROJECTNAME-EXTRACTNAME-QUERYFROMDATE-QUERYTODATE-SPLUNKINSTANCE-EXTRACTDATE.csv`
-Where
- - PROJECTNAME is `gpcanalytics`
- - EXTRACTNAME is `asidlookup`, `ssptrans` (MESH transactions TBC)
- - QUERYDATEFROM and QUERYDATETO is `YYYYMMDDTHHmmss`
- - SPLUNKINSTANCE is `cloud`, `spinea`, `spineb`
- - EXTRACTDATE is `YYYYMMDDTHHmmss`
+Where
+- PROJECTNAME is `gpcanalytics`
+- EXTRACTNAME is `asidlookup`, `ssptrans` (MESH transactions TBC)
+- QUERYDATEFROM and QUERYDATETO is `YYYYMMDDTHHmmss`
+- SPLUNKINSTANCE is `cloud`, `spinea`, `spineb`
+- EXTRACTDATE is `YYYYMMDDTHHmmss`
Examples:
@@ -55,7 +56,8 @@ Examples:
- `gpcanalytics-ssptrans-20200101T000000-20200107T000000-cloud-20210105T103000.csv`
- `gpcanalytics-ssptrans-20200107T000000-2020014T000000-spinea-20210105T103000.csv`
-Note: The QUERYDATEFROM and QUERYDATETO don't affect the output of the ASID lookup data query from Splunk, however are included for consistency.
+Note: The QUERYDATEFROM and QUERYDATETO don't affect the output of the ASID lookup data query from Splunk, however are
+included for consistency.
## Run a local SQL Server instance
@@ -67,3 +69,44 @@ To run the instance on the default port:
`docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=StrongP@ssword1' -p 1433:1433 -d mcr.microsoft.com/mssql/server`
+## Testing
+
+Tests were added the project on 8th Feb 2025 by Grant Riordan covering:
+
+- Core Project
+- Functions Project
+- Integration test for Hierarchy repository
+
+### How To Run Coverage Report
+
+**Run the coverage tests**:
+
+If you do not own a DotCover license or equivalent, you can use `coverlet` a free tool for running coverage reports.
+
+- navigate to the `/source` directory
+- open terminal and paste
+
+```bash
+dotnet test --collect:"XPlat Code Coverage" -m:1
+```
+
+or
+
+```bash
+dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=lcov
+
+```
+
+**Install Report Generator Globally**
+Report generator allows us to build a html report of the coverage making it easier to view.
+
+run the following to install:
+```bash
+dotnet tool install -g dotnet-reportgenerator-globaltool
+
+```
+then run the following to merge the coverage results into 1 report file
+
+```bash
+reportgenerator -reports:"../**/coverage.cobertura.xml" -reporttypes:"html" -targetdir:"./CoverageReport"
+- ```
diff --git a/source/.gitignore b/source/.gitignore
index ffdf0c2..9824b04 100644
--- a/source/.gitignore
+++ b/source/.gitignore
@@ -44,6 +44,7 @@ dlldata.c
project.lock.json
project.fragment.lock.json
artifacts/
+coverage/*
*_i.c
*_p.c
@@ -254,4 +255,4 @@ paket-files/
*.sln.iml
# CodeRush
-.cr/
\ No newline at end of file
+.cr/.DS_Store
diff --git a/source/.runsettings b/source/.runsettings
new file mode 100644
index 0000000..3a90f83
--- /dev/null
+++ b/source/.runsettings
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+ cobertura,opencover
+
+ [Core.DTOs]*,
+ [Core.DTOs.*]*
+
+
+ **/*.g.cs,
+ **/Generated*.cs,
+ **/Program.cs,
+ **/Microsoft.Azure.Functions.Worker.Sdk.Generators/**/*.cs
+
+
+ GeneratedCodeAttribute
+
+ true
+
+
+
+
+
\ No newline at end of file
diff --git a/source/Core.Tests/.gitignore b/source/Core.Tests/.gitignore
new file mode 100644
index 0000000..c74c428
--- /dev/null
+++ b/source/Core.Tests/.gitignore
@@ -0,0 +1,264 @@
+/coveragereport
+/TestResults
+
+# Azure Functions localsettings file
+local.settings.json
+
+# User-specific files
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+
+# Visual Studio 2015 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUNIT
+*.VisualState.xml
+TestResult.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# DNX
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+*_i.c
+*_p.c
+*_i.h
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# JustCode is a .NET coding add-in
+.JustCode
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# TODO: Comment the next line if you want to checkin your web deploy settings
+# but database connection strings (with potential passwords) will be unencrypted
+#*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# The packages folder can be ignored because of Package Restore
+**/packages/*
+# except build/, which is used as an MSBuild target.
+!**/packages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/packages/repositories.config
+# NuGet v3's project.json files produces more ignoreable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+node_modules/
+orleans.codegen.cs
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+*.mdf
+*.ldf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# JetBrains Rider
+.idea/
+*.sln.iml
+
+# CodeRush
+.cr/
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
\ No newline at end of file
diff --git a/source/Core.Tests/Core.Tests.csproj b/source/Core.Tests/Core.Tests.csproj
new file mode 100644
index 0000000..6891900
--- /dev/null
+++ b/source/Core.Tests/Core.Tests.csproj
@@ -0,0 +1,38 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+ false
+ true
+
+
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+
+
+
+
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+
+
+
diff --git a/source/Core.Tests/Helpers/ApplicationHelperTests.cs b/source/Core.Tests/Helpers/ApplicationHelperTests.cs
new file mode 100644
index 0000000..dc23801
--- /dev/null
+++ b/source/Core.Tests/Helpers/ApplicationHelperTests.cs
@@ -0,0 +1,104 @@
+using System.Reflection;
+using Core.Helpers;
+using FluentAssertions;
+using Moq;
+using Xunit;
+
+namespace Core.Tests.Helpers;
+
+public class ApplicationHelperTests
+{
+ public ApplicationHelperTests()
+ {
+ // Reset the environment variable before each test
+ Environment.SetEnvironmentVariable("BUILD_TAG", null);
+ }
+
+ [Fact]
+ public void GetAssemblyVersionInternal_ShouldReturnAssemblyFullName_WhenBuildTagIsNull()
+ {
+ // Arrange
+ Environment.SetEnvironmentVariable("BUILD_TAG", null);
+ var mockAssembly = new Mock>();
+ mockAssembly.Setup(x => x.Invoke()).Returns(typeof(ApplicationHelper).Assembly);
+
+ // Act
+ var result = ApplicationHelper.ApplicationVersion.GetAssemblyVersionInternal(mockAssembly.Object);
+
+ // Assert
+ result.Should().Be(typeof(ApplicationHelper).Assembly.GetName().FullName);
+ }
+
+ [Fact]
+ public void GetAssemblyVersion_ShouldReturnAssemblyFullName_WhenBuildTagIsNull()
+ {
+ // Arrange
+ Environment.SetEnvironmentVariable("BUILD_TAG", null);
+
+ // Act
+ var result = ApplicationHelper.ApplicationVersion.GetAssemblyVersion();
+
+ // Assert
+ result.Should().Be(typeof(ApplicationHelper).Assembly.GetName().FullName);
+ }
+
+ [Fact]
+ public void GetAssemblyVersionInternal_ShouldReturnAssemblyFullName_WhenBuildTagIsEmpty()
+ {
+ // Arrange
+ Environment.SetEnvironmentVariable("BUILD_TAG", "");
+ var mockAssembly = new Mock>();
+ mockAssembly.Setup(x => x.Invoke()).Returns(typeof(ApplicationHelper).Assembly);
+
+ // Act
+ var result = ApplicationHelper.ApplicationVersion.GetAssemblyVersionInternal(mockAssembly.Object);
+
+ // Assert
+ result.Should().Be(typeof(ApplicationHelper).Assembly.GetName().FullName);
+ }
+
+ [Fact]
+ public void GetAssemblyVersionInternal_ShouldReturnAssemblyFullName_WhenBuildTagIsWhitespace()
+ {
+ // Arrange
+ Environment.SetEnvironmentVariable("BUILD_TAG", " ");
+ var mockAssembly = new Mock>();
+ mockAssembly.Setup(x => x.Invoke()).Returns(typeof(ApplicationHelper).Assembly);
+
+ // Act
+ var result = ApplicationHelper.ApplicationVersion.GetAssemblyVersionInternal(mockAssembly.Object);
+
+ // Assert
+ result.Should().Be(typeof(ApplicationHelper).Assembly.GetName().FullName);
+ }
+
+ [Fact]
+ public void GetAssemblyVersionInternal_ShouldReturnBuildTag_WhenBuildTagIsSet()
+ {
+ // Arrange
+ string expectedBuildTag = "1.0.0-Build123";
+ Environment.SetEnvironmentVariable("BUILD_TAG", expectedBuildTag);
+ var mockAssembly = new Mock>();
+
+ // Act
+ var result = ApplicationHelper.ApplicationVersion.GetAssemblyVersionInternal(mockAssembly.Object);
+
+ // Assert
+ result.Should().Be(expectedBuildTag);
+ }
+
+ [Fact]
+ public void GetAssemblyVersionInternal_ShouldHandleNullAssembly()
+ {
+ // Arrange
+ Environment.SetEnvironmentVariable("BUILD_TAG", null);
+ var mockAssembly = new Mock>();
+ mockAssembly.Setup(x => x.Invoke()).Returns((Assembly)null);
+
+ // Act
+ var result = ApplicationHelper.ApplicationVersion.GetAssemblyVersionInternal(mockAssembly.Object);
+
+ // Assert
+ result.Should().BeNull();
+ }
+}
\ No newline at end of file
diff --git a/source/Core.Tests/Helpers/AttributeExtensionsTests.cs b/source/Core.Tests/Helpers/AttributeExtensionsTests.cs
new file mode 100644
index 0000000..32974bb
--- /dev/null
+++ b/source/Core.Tests/Helpers/AttributeExtensionsTests.cs
@@ -0,0 +1,87 @@
+using Core.Helpers;
+using FluentAssertions;
+using Xunit;
+
+namespace Core.Tests.Helpers
+{
+ public class AttributeExtensionsTests
+ {
+ [Fact]
+ public void GetFileType_ShouldReturnDocument_ForDocumentPath()
+ {
+ // Arrange
+ const string filePath = "/asid-lookup-data/report.docx";
+
+ // Act
+ var fileType = filePath.GetFileType();
+
+ // Assert
+ fileType.Should().Be(FileTypes.asidlookup);
+ }
+
+ [Fact]
+ public void GetFileType_ShouldReturnImage_ForImagePath()
+ {
+ // Arrange
+ const string filePath = "/ssp-transactions/file1.csv";
+
+ // Act
+ var fileType = filePath.GetFileType();
+
+ // Assert
+ fileType.Should().Be(FileTypes.ssptrans);
+ }
+
+ [Fact]
+ public void GetFileType_ShouldReturnVideo_ForVideoPath()
+ {
+ // Arrange
+ const string filePath = "/mesh-transactions/file1.csv";
+
+ // Act
+ var fileType = filePath.GetFileType();
+
+ // Assert
+ fileType.Should().Be(FileTypes.meshtrans);
+ }
+
+ [Fact]
+ public void GetFileType_ShouldReturnNull_ForUnknownPath()
+ {
+ // Arrange
+ const string filePath = "/unknown/path/file.txt";
+
+ // Act
+ var fileType = filePath.GetFileType();
+
+ // Assert
+ fileType.Should().BeNull();
+ }
+
+ [Fact]
+ public void GetFileType_ShouldReturnNull_ForEmptyPath()
+ {
+ // Arrange
+ const string filePath = "";
+
+ // Act
+ var fileType = filePath.GetFileType();
+
+ // Assert
+ fileType.Should().BeNull();
+ }
+
+ [Fact]
+ public void GetFileType_ShouldReturnNull_ForNullPath()
+ {
+ // Arrange
+ const string filePath = null;
+
+ // Act
+ var fileType = filePath.GetFileType();
+
+ // Assert
+ fileType.Should().BeNull();
+ }
+ }
+}
\ No newline at end of file
diff --git a/source/Core.Tests/Helpers/ConnectionStringsTests.cs b/source/Core.Tests/Helpers/ConnectionStringsTests.cs
new file mode 100644
index 0000000..b9e01d4
--- /dev/null
+++ b/source/Core.Tests/Helpers/ConnectionStringsTests.cs
@@ -0,0 +1,20 @@
+using Core.Helpers;
+using FluentAssertions;
+using Xunit;
+
+namespace Core.Tests.Helpers;
+
+public class ConnectionStringsTests
+{
+ [Fact]
+ public void GpConnectAnalytics_ShouldNotBeEmpty()
+ {
+ // Arrange
+ // Act
+ var result = ConnectionStrings.GpConnectAnalytics;
+
+ // Assert
+ result.Should().NotBeEmpty();
+ result.Should().Be("GpConnectAnalytics");
+ }
+}
\ No newline at end of file
diff --git a/source/Core.Tests/Helpers/DateFormatConstantsTests.cs b/source/Core.Tests/Helpers/DateFormatConstantsTests.cs
new file mode 100644
index 0000000..8ed0af8
--- /dev/null
+++ b/source/Core.Tests/Helpers/DateFormatConstantsTests.cs
@@ -0,0 +1,19 @@
+using Core.Helpers;
+using FluentAssertions;
+using Xunit;
+
+namespace Core.Tests.Helpers;
+
+public class DateFormatConstantsTests
+{
+ [Fact]
+ public void ValidateDateFormatConstants()
+ {
+ DateFormatConstants.FilePathQueryDate.Should().Be("yyyyMMdd");
+ DateFormatConstants.FilePathQueryHour.Should().Be("hhmmss");
+ DateFormatConstants.FilePathQueryDateYearMonth.Should().Be("yyyy-MM");
+ DateFormatConstants.FilePathNowDate.Should().Be("yyyyMMddTHHmmss");
+ DateFormatConstants.SplunkQueryDate.Should().Be("MM/dd/yyyy:HH:mm:ss");
+ DateFormatConstants.SplunkQueryHour.Should().Be("hhmm");
+ }
+}
\ No newline at end of file
diff --git a/source/Core.Tests/Helpers/DateTimeHelperTests.cs b/source/Core.Tests/Helpers/DateTimeHelperTests.cs
new file mode 100644
index 0000000..d8bc089
--- /dev/null
+++ b/source/Core.Tests/Helpers/DateTimeHelperTests.cs
@@ -0,0 +1,59 @@
+using Core.Helpers;
+using FluentAssertions;
+using Xunit;
+
+namespace Core.Tests.Helpers
+{
+ public class DateTimeHelperTests
+ {
+ [Fact]
+ public void EachDay_ShouldReturnAllDaysBetweenTwoDates_Inclusive()
+ {
+ // Arrange
+ var fromDate = new DateTime(2025, 1, 1);
+ var toDate = new DateTime(2025, 1, 5);
+
+ // Act
+ var result = DateTimeHelper.EachDay(fromDate, toDate).ToList();
+
+ // Assert
+ result.Should().HaveCount(5);
+ result.Should().ContainInOrder(
+ new DateTime(2025, 1, 1),
+ new DateTime(2025, 1, 2),
+ new DateTime(2025, 1, 3),
+ new DateTime(2025, 1, 4),
+ new DateTime(2025, 1, 5)
+ );
+ }
+
+ [Fact]
+ public void EachDay_ShouldReturnSingleDay_WhenFromAndToDatesAreSame()
+ {
+ // Arrange
+ var fromDate = new DateTime(2025, 1, 1);
+ var toDate = new DateTime(2025, 1, 1);
+
+ // Act
+ var result = DateTimeHelper.EachDay(fromDate, toDate).ToList();
+
+ // Assert
+ result.Should().HaveCount(1);
+ result.First().Should().Be(fromDate);
+ }
+
+ [Fact]
+ public void EachDay_ShouldReturnEmpty_WhenFromDateIsAfterToDate()
+ {
+ // Arrange
+ var fromDate = new DateTime(2025, 1, 5);
+ var toDate = new DateTime(2025, 1, 1);
+
+ // Act
+ var result = DateTimeHelper.EachDay(fromDate, toDate).ToList();
+
+ // Assert
+ result.Should().BeEmpty();
+ }
+ }
+}
\ No newline at end of file
diff --git a/source/Core.Tests/Helpers/FilePathTests.cs b/source/Core.Tests/Helpers/FilePathTests.cs
new file mode 100644
index 0000000..d64db8c
--- /dev/null
+++ b/source/Core.Tests/Helpers/FilePathTests.cs
@@ -0,0 +1,47 @@
+using Core.Helpers;
+using FluentAssertions;
+using Xunit;
+
+namespace Core.Tests.Helpers;
+
+public class FilePathTests
+{
+ [Fact]
+ public void FilePathValue_Returns_Value_WhenEmptyIsProvidedToConstructor()
+ {
+ // Arrange
+ var filePathAttribute = new FilePathAttribute("test_file_path");
+
+ // Act
+ var filePath = filePathAttribute.FilePath;
+
+ // Assert
+ filePath.Should().Be("test_file_path");
+ }
+
+ [Fact]
+ public void FilePathValue_Returns_Empty_WhenEmptyIsProvidedToConstructor()
+ {
+ // Arrange
+ var filePathAttribute = new FilePathAttribute("");
+
+ // Act
+ var filePath = filePathAttribute.FilePath;
+
+ // Assert
+ filePath.Should().Be("");
+ }
+
+ [Fact]
+ public void FilePathValue_Returns_Null_WhenNullIsProvidedToConstructor()
+ {
+ // Arrange
+ var filePathAttribute = new FilePathAttribute(null!);
+
+ // Act
+ var filePath = filePathAttribute.FilePath;
+
+ // Assert
+ filePath.Should().Be(null);
+ }
+}
\ No newline at end of file
diff --git a/source/Core.Tests/Services/DataServiceTests.cs b/source/Core.Tests/Services/DataServiceTests.cs
new file mode 100644
index 0000000..5d8fc49
--- /dev/null
+++ b/source/Core.Tests/Services/DataServiceTests.cs
@@ -0,0 +1,209 @@
+using System.Data;
+using System.Data.Common;
+using Core.Repositories;
+using Core.Services.Interfaces;
+using Dapper;
+using FluentAssertions;
+using Functions.Services;
+using Microsoft.Data.SqlClient;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Logging.Testing;
+using Moq;
+using Xunit;
+
+namespace Core.Tests.Services
+{
+ public class DataServiceTests
+ {
+ private readonly Mock _mockConfigService;
+ private readonly Mock _mockDapper;
+ private readonly DataService _dataService;
+ private readonly string _testConnectionString = "Server=localhost;Database=TestDb;User Id=test;Password=test;";
+ private readonly Mock _mockConnectionFactory;
+ private readonly FakeLogger _fakeLogger;
+ private readonly Mock _mockConnection;
+
+ public DataServiceTests()
+ {
+ _fakeLogger = new FakeLogger();
+ _mockConfigService = new Mock();
+ _mockDapper = new Mock();
+ _mockConnectionFactory = new Mock();
+
+ _mockDapper.Setup(d => d.ExecuteAsync(
+ It.IsAny(), It.IsAny(), It.IsAny