Files
ECMJobRunner/ECMJobRunner.Tests/Mapping/TestMappingProfile.cs
TekH ee3af3e462 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`.
2026-07-09 16:09:19 +02:00

25 lines
727 B
C#

using AutoMapper;
using ECMJobRunner.Domain.Entities;
using ECMJobRunner.Tests.DTOs;
namespace ECMJobRunner.Tests.Mapping
{
/// <summary>
/// AutoMapper profile for test DTOs
/// </summary>
public class TestMappingProfile : Profile
{
/// <summary>
/// Constructor configuring test DTO mappings
/// </summary>
public TestMappingProfile()
{
// CfgProfileDto -> CfgProfile
CreateMap<CfgProfileDto, CfgProfile>()
.ForMember(dest => dest.Id, opt => opt.Ignore())
.ForMember(dest => dest.SqlJobs, opt => opt.Ignore())
.ForMember(dest => dest.ProfileHistories, opt => opt.Ignore());
}
}
}