26ff8d9b4f
Set up repository with legacy .NET Framework 4.8 source (OLD/), new .NET 10 Blazor solution (NEW/), OpenSpec specifications, documentation, and project configuration.
38 lines
1.2 KiB
C#
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>();
|
|
}
|
|
}
|