feat(etl): add column mapping to destinations (intersect with dest schema)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System.Data;
|
||||
using JdeScoping.DataAccess.Interfaces;
|
||||
using JdeScoping.DataSync.Etl.Destinations;
|
||||
using NSubstitute;
|
||||
@@ -6,6 +7,28 @@ namespace JdeScoping.DataSync.Tests.Etl.Destinations;
|
||||
|
||||
public class DbBulkImportDestinationTests
|
||||
{
|
||||
/// <summary>
|
||||
/// This test documents that column mapping is applied to ignore extra source columns.
|
||||
/// The actual functionality requires a database connection and is an integration test concept.
|
||||
/// The implementation fetches destination columns from INFORMATION_SCHEMA.COLUMNS
|
||||
/// and only maps columns that exist in both source and destination.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void WriteAsync_SourceHasExtraColumns_IgnoresExtraColumns_IntegrationTestConcept()
|
||||
{
|
||||
// This is an integration test concept -
|
||||
// The actual behavior verifies that column mappings are applied:
|
||||
// 1. GetDestinationColumnsAsync fetches columns from INFORMATION_SCHEMA.COLUMNS
|
||||
// 2. Column mappings only added for columns in destination (case-insensitive)
|
||||
// 3. Extra source columns are silently ignored during bulk copy
|
||||
//
|
||||
// To test this fully, an integration test with a real database is required.
|
||||
// The unit test here just verifies the component can be constructed.
|
||||
var factory = Substitute.For<IDbConnectionFactory>();
|
||||
var dest = new DbBulkImportDestination(factory, "TestTable");
|
||||
Assert.NotNull(dest);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_SetsDestinationName()
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Data;
|
||||
using JdeScoping.DataAccess.Interfaces;
|
||||
using JdeScoping.DataSync.Etl.Destinations;
|
||||
using NSubstitute;
|
||||
@@ -6,6 +7,28 @@ namespace JdeScoping.DataSync.Tests.Etl.Destinations;
|
||||
|
||||
public class DbBulkMergeDestinationTests
|
||||
{
|
||||
/// <summary>
|
||||
/// This test documents that column mapping is applied to ignore extra source columns.
|
||||
/// The actual functionality requires a database connection and is an integration test concept.
|
||||
/// The implementation fetches destination columns from INFORMATION_SCHEMA.COLUMNS
|
||||
/// and only maps columns that exist in both source and destination.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void WriteAsync_SourceHasExtraColumns_IgnoresExtraColumns_IntegrationTestConcept()
|
||||
{
|
||||
// This is an integration test concept -
|
||||
// The actual behavior verifies that column mappings are applied:
|
||||
// 1. GetDestinationColumnsAsync fetches columns from INFORMATION_SCHEMA.COLUMNS
|
||||
// 2. ProcessBatchAsync only adds column mappings for columns in destination
|
||||
// 3. Extra source columns are silently ignored during bulk copy
|
||||
//
|
||||
// To test this fully, an integration test with a real database is required.
|
||||
// The unit test here just verifies the component can be constructed.
|
||||
var factory = Substitute.For<IDbConnectionFactory>();
|
||||
var dest = new DbBulkMergeDestination(factory, "TestTable", new[] { "Id" });
|
||||
Assert.NotNull(dest);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_SetsDestinationName()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user