Files
jdescopingtool/NEW/tests/JdeScoping.DataSync.IntegrationTests/Infrastructure/TestDataReaderFactory.cs
T
Joseph Doherty 26ff8d9b4f Initial commit: JDE Scoping Tool migration project
Set up repository with legacy .NET Framework 4.8 source (OLD/),
new .NET 10 Blazor solution (NEW/), OpenSpec specifications,
documentation, and project configuration.
2026-01-02 07:43:29 -05:00

38 lines
1.2 KiB
C#

using System.Data;
using JdeScoping.DataSync.Contracts;
using JdeScoping.DataSync.Generated;
namespace JdeScoping.DataSync.IntegrationTests.Infrastructure;
/// <summary>
/// DataReaderFactory for integration tests that supports both test entities and production entities.
/// </summary>
public class TestDataReaderFactory : IDataReaderFactory
{
private readonly DataReaderFactory _innerFactory = new();
public IDataReader CreateReader<T>(IAsyncEnumerable<T> source) where T : class
{
// Handle test entity
if (typeof(T) == typeof(BulkMergeTestEntity))
{
return new BulkMergeTestEntityDataReader((IAsyncEnumerable<BulkMergeTestEntity>)(object)source);
}
// Delegate to production factory for other types
return _innerFactory.CreateReader(source);
}
public IReadOnlyList<string> GetColumnNames<T>() where T : class
{
// Handle test entity
if (typeof(T) == typeof(BulkMergeTestEntity))
{
return BulkMergeTestEntityDataReader.GetColumnNames();
}
// Delegate to production factory for other types
return _innerFactory.GetColumnNames<T>();
}
}