public async Task BulkUpdateDataInTableWithCompositeAndIdentityPrimaryKey()
        {
            List <BulkUpdateItemComposite> actualData = null;

            using (var helper = CreateHelper(new[] { CompositeWithIdentity_CreateTable, CompositeWithIdentity_InsertData }))
                using (var bulkUpdate = new SqlServerBulkUpdate(helper.Connection))
                {
                    var dataToUpdate = new EnumerableDataReader <BulkUpdateItemComposite>(
                        new[] {
                        new BulkUpdateItemComposite()
                        {
                            Id1 = 1, Id2 = 2, Value = "lorem ipsum 2"
                        },
                        new BulkUpdateItemComposite()
                        {
                            Id1 = 2, Id2 = 3, Value = "lorem ipsum 3"
                        },
                        new BulkUpdateItemComposite()
                        {
                            Id1 = 3, Id2 = 6, Value = "lorem ipsum 6"
                        }
                    },
                        new[] { nameof(BulkUpdateItemComposite.Id1), nameof(BulkUpdateItemComposite.Id2), nameof(BulkUpdateItemIdentity.Value) });

                    bulkUpdate.DestinationTableName = CompositeWithIdentity_TableName;
                    bulkUpdate.PrimaryKeyColumn     = nameof(BulkUpdateItemComposite.Id1) + ", " + nameof(BulkUpdateItemComposite.Id2);
                    await bulkUpdate.UpdateAsync(dataToUpdate);

                    helper.Connection.Open();
                    actualData = LoadDataForTableWithCompositePk(helper.Connection, CompositeWithIdentity_TableName);
                }

            actualData.Should().Equal(new List <BulkUpdateItemComposite>(new[]
            {
                new BulkUpdateItemComposite()
                {
                    Id1 = 1, Id2 = 1, Value = "1 - 1"
                },
                new BulkUpdateItemComposite()
                {
                    Id1 = 1, Id2 = 2, Value = "lorem ipsum 2"
                },
                new BulkUpdateItemComposite()
                {
                    Id1 = 2, Id2 = 3, Value = "lorem ipsum 3"
                },
                new BulkUpdateItemComposite()
                {
                    Id1 = 2, Id2 = 4, Value = "2 - 4"
                },
                new BulkUpdateItemComposite()
                {
                    Id1 = 3, Id2 = 5, Value = "3 - 5"
                },
                new BulkUpdateItemComposite()
                {
                    Id1 = 3, Id2 = 6, Value = "lorem ipsum 6"
                },
            }));
        }
        public async Task BulkUpdateDataFromDataTableAsynchronously()
        {
            DataTable expectedData = CreateExpectedData();

            using (var bulkUpdate = new SqlServerBulkUpdate(ServerHelper.Connection))
            {
                bulkUpdate.DestinationTableName = TableName;
                bulkUpdate.PrimaryKeyColumn     = PrimaryKeyColumn;
                await bulkUpdate.UpdateAsync(expectedData);
            }

            DataTable actualData = LoadData(ServerHelper.Connection);

            SqlServerBulkHelper.CompareTables(actualData, expectedData);
        }
        public async Task BulkUpdateDataFromIBulkInsertDataReaderAsynchronously()
        {
            DataTable expectedData = CreateExpectedData();
            DataTable actualData   = null;

            using (IBulkActionDataReader reader = CreateDataReaderForUpdate())
                using (var bulkUpdate = new SqlServerBulkUpdate(ServerHelper.Connection))
                {
                    bulkUpdate.DestinationTableName = TABLE_NAME;
                    bulkUpdate.PrimaryKeyColumn     = PRIMARY_KEY_COLUMN;
                    await bulkUpdate.UpdateAsync(reader);
                }

            actualData = LoadData(ServerHelper.Connection);

            SqlServerBulkHelper.CompareTables(actualData, expectedData);
        }
        public async Task BulkUpdateDataInTableWithIdentityPrimaryKey()
        {
            List <BulkUpdateItemIdentity> actualData = null;

            using (var helper = CreateHelper(new[] { Identity_CreateTable, Identity_InsertData }))
                using (var bulkUpdate = new SqlServerBulkUpdate(helper.Connection))
                {
                    var dataToUpdate = new EnumerableDataReader <BulkUpdateItemIdentity>(
                        new[] { new BulkUpdateItemIdentity()
                                {
                                    Id = 2, Value = "lorem ipsum"
                                } },
                        new[] { nameof(BulkUpdateItemIdentity.Id), nameof(BulkUpdateItemIdentity.Value) });

                    bulkUpdate.DestinationTableName = Identity_TableName;
                    bulkUpdate.PrimaryKeyColumn     = nameof(BulkUpdateItemIdentity.Id);
                    await bulkUpdate.UpdateAsync(dataToUpdate);

                    helper.Connection.Open();
                    actualData = LoadDataForTableWithIdentity(helper.Connection);
                }

            actualData.Should().Equal(new List <BulkUpdateItemIdentity>(new[]
            {
                new BulkUpdateItemIdentity()
                {
                    Id = 1, Value = "one"
                },
                new BulkUpdateItemIdentity()
                {
                    Id = 2, Value = "lorem ipsum"
                },
                new BulkUpdateItemIdentity()
                {
                    Id = 3, Value = "three"
                }
            }));
        }