Add test infrastructure and repository tests

Introduced `CfgProfileDto` for testing and added a `FakeDataGenerator` utility for generating test data. Updated `ECMJobRunner.Tests.csproj` to support both `.NET Framework 4.8` and `.NET 8.0`, enabling nullable reference types and adding dependencies for testing frameworks, DI, and AutoMapper.

Added `TestFixture` to set up dependency injection and in-memory databases for tests. Created `TestMappingProfile` for AutoMapper configurations. Implemented `CfgProfileRepositoryTests` to validate repository methods, including `GetByIdAsync`, `GetAllAsync`, `AddAsync`, and `FindAsync`.

Enhanced test maintainability with `FluentAssertions` and realistic data generation using `Bogus`.
This commit is contained in:
2026-07-09 16:09:19 +02:00
parent bd6c1c1309
commit ee3af3e462
6 changed files with 428 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
using System;
namespace ECMJobRunner.Tests.DTOs
{
/// <summary>
/// DTO for CfgProfile entity used in tests
/// </summary>
public class CfgProfileDto
{
public bool Active { get; set; }
public string ProfileName { get; set; } = string.Empty;
public byte TypeId { get; set; }
public string? Schedule { get; set; }
public string? Comment { get; set; }
public string AddedWho { get; set; } = string.Empty;
public DateTime AddedWhen { get; set; }
public string ChangedWho { get; set; } = string.Empty;
public DateTime ChangedWhen { get; set; }
}
}