public void TestSystemSqlConnectionBaseRepositoryBulkDeleteForEntitiesWithExtraFields() { // Setup var tables = Helper.CreateWithExtraFieldsBulkOperationIdentityTables(10); using (var withExtraFieldsRepository = new WithExtraFieldsBulkOperationIdentityTableRepository()) { // Act withExtraFieldsRepository.InsertAll(tables); // Act var bulkDeleteResult = withExtraFieldsRepository.BulkDelete(tables); using (var repository = new BulkOperationIdentityTableRepository()) { // Act var queryResult = repository.QueryAll(); // Assert Assert.AreEqual(tables.Count, bulkDeleteResult); // Act var countResult = repository.CountAll(); // Assert Assert.AreEqual(0, countResult); } } }
public void TestMicrosoftSqlConnectionBaseRepositoryBulkDeleteForEntitiesWithExtraFieldsWithMappings() { // Setup var tables = Helper.CreateWithExtraFieldsBulkOperationIdentityTables(10); var mappings = new List <BulkInsertMapItem>(); // Add the mappings mappings.Add(new BulkInsertMapItem(nameof(BulkOperationIdentityTable.ColumnBit), nameof(BulkOperationIdentityTable.ColumnBit))); mappings.Add(new BulkInsertMapItem(nameof(BulkOperationIdentityTable.ColumnDateTime), nameof(BulkOperationIdentityTable.ColumnDateTime))); mappings.Add(new BulkInsertMapItem(nameof(BulkOperationIdentityTable.ColumnDateTime2), nameof(BulkOperationIdentityTable.ColumnDateTime2))); mappings.Add(new BulkInsertMapItem(nameof(BulkOperationIdentityTable.ColumnDecimal), nameof(BulkOperationIdentityTable.ColumnDecimal))); mappings.Add(new BulkInsertMapItem(nameof(BulkOperationIdentityTable.ColumnFloat), nameof(BulkOperationIdentityTable.ColumnFloat))); mappings.Add(new BulkInsertMapItem(nameof(BulkOperationIdentityTable.ColumnInt), nameof(BulkOperationIdentityTable.ColumnInt))); mappings.Add(new BulkInsertMapItem(nameof(BulkOperationIdentityTable.ColumnNVarChar), nameof(BulkOperationIdentityTable.ColumnNVarChar))); using (var withExtraFieldsRepository = new WithExtraFieldsBulkOperationIdentityTableRepository()) { // Act withExtraFieldsRepository.InsertAll(tables); // Act var bulkDeleteResult = withExtraFieldsRepository.BulkDelete(tables); using (var repository = new BulkOperationIdentityTableRepository()) { // Act var queryResult = repository.QueryAll(); // Assert Assert.AreEqual(tables.Count, bulkDeleteResult); // Act var countResult = repository.CountAll(); // Assert Assert.AreEqual(0, countResult); } } }