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/database/schema/V1.6__AddHierarchyProviderTable.sql b/database/schema/V1.6__AddHierarchyProviderTable.sql
new file mode 100644
index 0000000..b67e2fc
--- /dev/null
+++ b/database/schema/V1.6__AddHierarchyProviderTable.sql
@@ -0,0 +1,20 @@
+SET
+ ANSI_NULLS ON;
+
+SET
+ QUOTED_IDENTIFIER ON;
+
+CREATE TABLE Data.HierarchyProviderConsumers (
+ OdsCode NVARCHAR(450) NOT NULL,
+ PracticeName NVARCHAR(MAX) NULL,
+ RegisteredPatientCount INT NOT NULL,
+ RegionCode NVARCHAR(MAX) NULL,
+ RegionName NVARCHAR(MAX) NULL,
+ Icb22Name NVARCHAR(MAX) NULL,
+ PcnName NVARCHAR(MAX) NULL,
+ Appointments13000 INT NOT NULL,
+ CONSTRAINT PK_HierarchyProviderConsumers PRIMARY KEY CLUSTERED (OdsCode ASC)
+) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY];
+
+SET
+ ANSI_PADDING ON;
\ No newline at end of file
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