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:
20
ECMJobRunner.Tests/DTOs/CfgProfileDto.cs
Normal file
20
ECMJobRunner.Tests/DTOs/CfgProfileDto.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user