Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/buildwindowsimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ jobs:

steps:
- uses: actions/[email protected]

- name: Install NET 9
uses: actions/[email protected]
with:
dotnet-version: '9.0.x'

- name: Get the version
id: get_version
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/createrelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ jobs:
steps:
- uses: actions/[email protected]

- name: Install NET 9
uses: actions/[email protected]
with:
dotnet-version: '9.0.x'

- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/nightlybuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ jobs:

steps:
- uses: actions/[email protected]

- name: Install NET 9
uses: actions/[email protected]
with:
dotnet-version: '9.0.x'

- name: Set Up Variables
run: echo "action_url=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_ENV
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/pullrequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ jobs:
steps:
- uses: actions/[email protected]

- name: Install NET 9
uses: actions/[email protected]
with:
dotnet-version: '9.0.x'

- name: Echo vars
run: |
echo "CI is > ${CI}"
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/pushtomain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ jobs:
- uses: actions/[email protected]
with:
fetch-depth: 0

- name: Install NET 9
uses: actions/[email protected]
with:
dotnet-version: '9.0.x'

- name: Restore Nuget Packages
run: dotnet restore FileProcessor.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }}
Expand Down
2 changes: 1 addition & 1 deletion FIleProcessor.Models/FIleProcessor.Models.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<DebugType>None</DebugType>
</PropertyGroup>

Expand Down
33 changes: 21 additions & 12 deletions FileProcessor.BusinessLogic.Tests/FileProcessingManagerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ public async Task FileProcessingManager_GetFileImportLogs_NoMerchantId_ImportLog
new Mock<IAggregateRepository<FileAggregate, DomainEvent>>();
FileProcessorManager manager = new FileProcessorManager(fileProfiles, contextFactory.Object, modelFactory, fileAggregateRepository.Object);

List<FileImportLog> importLogs = await manager.GetFileImportLogs(TestData.EstateId, TestData.ImportLogStartDate, TestData.ImportLogEndDate, null, CancellationToken.None);

Result<List<FileImportLog>> getFileImportLogsResult = await manager.GetFileImportLogs(TestData.EstateId, TestData.ImportLogStartDate, TestData.ImportLogEndDate, null, CancellationToken.None);
getFileImportLogsResult.IsSuccess.ShouldBeTrue();
List<FileImportLog> importLogs = getFileImportLogsResult.Data;
this.VerifyImportLogs(TestData.FileImportLogs,importLogs);
}

Expand Down Expand Up @@ -164,7 +165,10 @@ public async Task FileProcessingManager_GetFileImportLog_WithMerchantId_ImportLo
[Fact]
public async Task FileProcessingManager_GetFile_FileReturned()
{
List<FileProfile> fileProfiles = new List<FileProfile>();
List<FileProfile> fileProfiles = new List<FileProfile>
{
TestData.FileProfile
};
var context = await this.GetContext(Guid.NewGuid().ToString("N"));
var contextFactory = this.CreateMockContextFactory();
contextFactory.Setup(c => c.GetContext(It.IsAny<Guid>(), It.IsAny<String>(), It.IsAny<CancellationToken>())).ReturnsAsync(context);
Expand All @@ -181,7 +185,6 @@ public async Task FileProcessingManager_GetFile_FileReturned()
this.VerifyFile(TestData.GetFileAggregateWithLines(), fileDetails);
fileDetails.Data.MerchantName.ShouldBeNull();
fileDetails.Data.UserEmailAddress.ShouldBeNull();
fileDetails.Data.FileProfileName.ShouldBeNull();
}

[Fact]
Expand All @@ -206,7 +209,10 @@ public async Task FileProcessingManager_GetFile_FileAggregateFailed_ErrorReturne
[Fact]
public async Task FileProcessingManager_GetFile_FileReturnedWithMerchantName()
{
List<FileProfile> fileProfiles = new List<FileProfile>();
List<FileProfile> fileProfiles = new List<FileProfile>
{
TestData.FileProfile
};
var context = await this.GetContext(Guid.NewGuid().ToString("N"));
context.Merchants.Add(new Merchant
{
Expand Down Expand Up @@ -235,7 +241,10 @@ public async Task FileProcessingManager_GetFile_FileReturnedWithMerchantName()
[Fact]
public async Task FileProcessingManager_GetFile_FileReturnedWithUserEmailAddress()
{
List<FileProfile> fileProfiles = new List<FileProfile>();
List<FileProfile> fileProfiles = new List<FileProfile>
{
TestData.FileProfile
};
var context = await this.GetContext(Guid.NewGuid().ToString("N"));
context.EstateSecurityUsers.Add(new EstateSecurityUser()
{
Expand Down Expand Up @@ -380,19 +389,19 @@ private void VerifyImportLog(TransactionProcessor.Database.Entities.FileImportLo
}
}

private Mock<Shared.EntityFramework.IDbContextFactory<EstateManagementGenericContext>> CreateMockContextFactory()
private Mock<Shared.EntityFramework.IDbContextFactory<EstateManagementContext>> CreateMockContextFactory()
{
return new Mock<Shared.EntityFramework.IDbContextFactory<EstateManagementGenericContext>>();
return new Mock<Shared.EntityFramework.IDbContextFactory<EstateManagementContext>>();
}

private async Task<EstateManagementGenericContext> GetContext(String databaseName)
private async Task<EstateManagementContext> GetContext(String databaseName)
{
EstateManagementGenericContext context = null;
EstateManagementContext context = null;

DbContextOptionsBuilder<EstateManagementGenericContext> builder = new DbContextOptionsBuilder<EstateManagementGenericContext>()
DbContextOptionsBuilder<EstateManagementContext> builder = new DbContextOptionsBuilder<EstateManagementContext>()
.UseInMemoryDatabase(databaseName)
.ConfigureWarnings(w => w.Ignore(InMemoryEventId.TransactionIgnoredWarning));
context = new EstateManagementSqlServerContext(builder.Options);
context = new EstateManagementContext(builder.Options);

return context;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<DebugType>None</DebugType>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.14" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.14" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="9.0.5" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="Shouldly" Version="4.3.0" />
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="22.0.11" />
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="22.0.14" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2">
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MySqlConnector;

namespace FileProcessor.BusinessLogic.Common
{
Expand All @@ -19,7 +18,7 @@
{
#region Methods

public async Task CreateConnectionString(String externalIdentifier,

Check warning on line 21 in FileProcessor.BusinessLogic/Common/ConfigurationReaderConnectionStringRepository.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 21 in FileProcessor.BusinessLogic/Common/ConfigurationReaderConnectionStringRepository.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
String connectionStringIdentifier,
String connectionString,
CancellationToken cancellationToken)
Expand All @@ -27,43 +26,31 @@
throw new NotImplementedException("This is only required to complete the interface");
}

public async Task DeleteConnectionStringConfiguration(String externalIdentifier,

Check warning on line 29 in FileProcessor.BusinessLogic/Common/ConfigurationReaderConnectionStringRepository.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 29 in FileProcessor.BusinessLogic/Common/ConfigurationReaderConnectionStringRepository.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
String connectionStringIdentifier,
CancellationToken cancellationToken)
{
throw new NotImplementedException("This is only required to complete the interface");
}

public async Task<String> GetConnectionString(String externalIdentifier,

Check warning on line 36 in FileProcessor.BusinessLogic/Common/ConfigurationReaderConnectionStringRepository.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 36 in FileProcessor.BusinessLogic/Common/ConfigurationReaderConnectionStringRepository.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
String connectionStringIdentifier,
CancellationToken cancellationToken)
{
String connectionString = string.Empty;
String databaseName = string.Empty;

String databaseEngine = ConfigurationReader.GetValue("AppSettings", "DatabaseEngine");

databaseName = $"{connectionStringIdentifier}{externalIdentifier}";
connectionString = ConfigurationReader.GetConnectionString(connectionStringIdentifier);

DbConnectionStringBuilder builder = null;

if (databaseEngine == "MySql")
{
builder = new MySqlConnectionStringBuilder(connectionString)
{
Database = databaseName
};
}
else
// Default to SQL Server
builder = new SqlConnectionStringBuilder(connectionString)
{
// Default to SQL Server
builder = new SqlConnectionStringBuilder(connectionString)
{
InitialCatalog = databaseName
};
}

InitialCatalog = databaseName
};

return builder.ToString();
}

Expand Down
26 changes: 13 additions & 13 deletions FileProcessor.BusinessLogic/FileProcessor.BusinessLogic.csproj
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.14" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
<PackageReference Include="SecurityService.Client" Version="2025.1.1" />
<PackageReference Include="Shared" Version="2025.3.1" />
<PackageReference Include="Shared.DomainDrivenDesign" Version="2025.3.1" />
<PackageReference Include="MediatR" Version="12.4.1" />
<PackageReference Include="Shared.EventStore" Version="2025.3.1" />
<PackageReference Include="System.IO.Abstractions" Version="22.0.11" />
<PackageReference Include="TransactionProcessor.Client" Version="2025.2.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.14" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.14" />
<PackageReference Include="TransactionProcessor.Database" Version="2025.2.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.5" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.5" />
<PackageReference Include="SecurityService.Client" Version="2025.5.2-build82" />
<PackageReference Include="Shared" Version="2025.6.2" />
<PackageReference Include="Shared.DomainDrivenDesign" Version="2025.6.2" />
<PackageReference Include="MediatR" Version="12.5.0" />
<PackageReference Include="Shared.EventStore" Version="2025.6.2" />
<PackageReference Include="System.IO.Abstractions" Version="22.0.14" />
<PackageReference Include="TransactionProcessor.Client" Version="2025.5.2-build186" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.5" />
<PackageReference Include="TransactionProcessor.Database" Version="2025.5.2-build186" />
</ItemGroup>

<ItemGroup>
Expand Down
17 changes: 11 additions & 6 deletions FileProcessor.BusinessLogic/Managers/FileProcessorManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
/// </summary>
private readonly List<FileProfile> FileProfiles;

private readonly Shared.EntityFramework.IDbContextFactory<EstateManagementGenericContext> DbContextFactory;
private readonly Shared.EntityFramework.IDbContextFactory<EstateManagementContext> DbContextFactory;

private readonly IModelFactory ModelFactory;

Expand All @@ -53,7 +53,7 @@
/// <param name="dbContextFactory">The database context factory.</param>
/// <param name="modelFactory">The model factory.</param>
public FileProcessorManager(List<FileProfile> fileProfiles,
Shared.EntityFramework.IDbContextFactory<EstateManagementGenericContext> dbContextFactory,
Shared.EntityFramework.IDbContextFactory<EstateManagementContext> dbContextFactory,
IModelFactory modelFactory,
IAggregateRepository<FileAggregate, DomainEvent> fileAggregateRepository)
{
Expand All @@ -67,12 +67,12 @@

#region Methods

public async Task<Result<List<FileProfile>>> GetAllFileProfiles(CancellationToken cancellationToken)

Check warning on line 70 in FileProcessor.BusinessLogic/Managers/FileProcessorManager.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 70 in FileProcessor.BusinessLogic/Managers/FileProcessorManager.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
return Result.Success(this.FileProfiles);
}

public async Task<Result<FileProfile>> GetFileProfile(Guid fileProfileId,

Check warning on line 75 in FileProcessor.BusinessLogic/Managers/FileProcessorManager.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 75 in FileProcessor.BusinessLogic/Managers/FileProcessorManager.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
CancellationToken cancellationToken)
{
FileProfile fileProfile = this.FileProfiles.SingleOrDefault(f => f.FileProfileId == fileProfileId);
Expand All @@ -89,7 +89,7 @@
Guid? merchantId,
CancellationToken cancellationToken)
{
EstateManagementGenericContext context = await this.DbContextFactory.GetContext(estateId, ConnectionStringIdentifier, cancellationToken);
EstateManagementContext context = await this.DbContextFactory.GetContext(estateId, ConnectionStringIdentifier, cancellationToken);

List<TransactionProcessor.Database.Entities.FileImportLog> importLogQuery =
await context.FileImportLogs.Where(f => f.ImportLogDateTime >= startDateTime).ToListAsync(cancellationToken);
Expand Down Expand Up @@ -130,7 +130,7 @@
Guid? merchantId,
CancellationToken cancellationToken)
{
EstateManagementGenericContext context = await this.DbContextFactory.GetContext(estateId, ConnectionStringIdentifier, cancellationToken);
EstateManagementContext context = await this.DbContextFactory.GetContext(estateId, ConnectionStringIdentifier, cancellationToken);

// Fetch the import log entry
TransactionProcessor.Database.Entities.FileImportLog importLogQuery = await context.FileImportLogs
Expand Down Expand Up @@ -179,7 +179,7 @@

FileDetails fileDetails = fileAggregate.GetFile();

EstateManagementGenericContext context = await this.DbContextFactory.GetContext(estateId, ConnectionStringIdentifier, cancellationToken);
EstateManagementContext context = await this.DbContextFactory.GetContext(estateId, ConnectionStringIdentifier, cancellationToken);

Merchant merchant = await context.Merchants
.SingleOrDefaultAsync(m => m.MerchantId == fileDetails.MerchantId, cancellationToken);
Expand All @@ -196,7 +196,12 @@
fileDetails.UserEmailAddress = userDetails.EmailAddress;
}

FileProfile fileProfile = await this.GetFileProfile(fileDetails.FileProfileId, cancellationToken);
Result<FileProfile> getFileProfile = await this.GetFileProfile(fileDetails.FileProfileId, cancellationToken);
if (getFileProfile.IsFailed)
{
return ResultHelpers.CreateFailure(getFileProfile);
}
FileProfile fileProfile = getFileProfile.Data;
if (fileProfile != null)
{
fileDetails.FileProfileName = fileProfile.Name;
Expand Down
Loading
Loading