public void WithDeltaDestination(IConnectionManager connection) { //Arrange TwoColumnsTableFixture s2c = new TwoColumnsTableFixture(connection, "DBMergeSource"); s2c.InsertTestData(); s2c.InsertTestDataSet2(); TwoColumnsTableFixture d2c = new TwoColumnsTableFixture(connection, "DBMergeDestination"); d2c.InsertTestDataSet3(); TwoColumnsDeltaTableFixture delta2Columns = new TwoColumnsDeltaTableFixture(connection, "DBMergeDelta"); DbSource <MySimpleRow> source = new DbSource <MySimpleRow>("DBMergeSource", connection); //Act DbMerge <MySimpleRow> merge = new DbMerge <MySimpleRow>(MergeMode.Full, "DBMergeDestination", connection); DbDestination <MySimpleRow> delta = new DbDestination <MySimpleRow>("DBMergeDelta", connection); source.LinkTo(merge); merge.LinkTo(delta); source.Execute(); merge.Wait(); delta.Wait(); //Assert Assert.True(merge.UseTruncateMethod == true); Assert.Equal(6, RowCountTask.Count(connection, "DBMergeDestination", $"{d2c.QB}Col1{d2c.QE} BETWEEN 1 AND 7 AND {d2c.QB}Col2{d2c.QE} LIKE 'Test%'")); Assert.Equal(7, RowCountTask.Count(connection, "DBMergeDelta", $"{d2c.QB}Col1{d2c.QE} BETWEEN 1 AND 10 AND {d2c.QB}Col2{d2c.QE} LIKE 'Test%'")); Assert.Equal(1, RowCountTask.Count(connection, "DBMergeDelta", $"{d2c.QB}ChangeAction{d2c.QE} = 'D' AND {d2c.QB}Col1{d2c.QE} = 10")); Assert.Equal(3, RowCountTask.Count(connection, "DBMergeDelta", $"{d2c.QB}ChangeAction{d2c.QE} = 'U' AND {d2c.QB}Col1{d2c.QE} IN (1,2,4)")); Assert.Equal(3, RowCountTask.Count(connection, "DBMergeDelta", $"{d2c.QB}ChangeAction{d2c.QE} = 'I' AND {d2c.QB}Col1{d2c.QE} IN (3,5,6)")); }
public void WithDeltaDestination(IConnectionManager connection) { //Arrange TwoColumnsTableFixture source2Columns = new TwoColumnsTableFixture(connection, "DBMergeSource"); source2Columns.InsertTestData(); source2Columns.InsertTestDataSet2(); TwoColumnsTableFixture dest2Columns = new TwoColumnsTableFixture(connection, "DBMergeDestination"); dest2Columns.InsertTestDataSet3(); TwoColumnsDeltaTableFixture delta2Columns = new TwoColumnsDeltaTableFixture(connection, "DBMergeDelta"); DBSource <MySimpleRow> source = new DBSource <MySimpleRow>(connection, "DBMergeSource"); //Act DBMerge <MySimpleRow> merge = new DBMerge <MySimpleRow>(connection, "DBMergeDestination"); DBDestination <MySimpleRow> delta = new DBDestination <MySimpleRow>(connection, "DBMergeDelta"); source.LinkTo(merge); merge.LinkTo(delta); source.Execute(); merge.Wait(); delta.Wait(); //Assert Assert.Equal(6, RowCountTask.Count(connection, "DBMergeDestination", "Col1 BETWEEN 1 AND 7 AND Col2 LIKE 'Test%'")); Assert.Equal(7, RowCountTask.Count(connection, "DBMergeDelta", "Col1 BETWEEN 1 AND 10 AND Col2 LIKE 'Test%'")); Assert.Equal(1, RowCountTask.Count(connection, "DBMergeDelta", "ChangeAction = 'D' AND Col1 = 10")); Assert.Equal(3, RowCountTask.Count(connection, "DBMergeDelta", "ChangeAction = 'U' AND Col1 IN (1,2,4)")); Assert.Equal(3, RowCountTask.Count(connection, "DBMergeDelta", "ChangeAction = 'I' AND Col1 IN (3,5,6)")); }