private static void IsValidInsert(IdentityAndNotMappedTest inserted, IdentityAndNotMappedTest toBeInserted) { inserted.IdKey.Should().BePositive(); inserted.Ignored.Should().NotBe(toBeInserted.Ignored); inserted.Name.Should().Be(toBeInserted.Name); inserted.TestSublass.Should().BeNull(); }
public async Task InsertSingleAsync() { var item = new IdentityAndNotMappedTest { Name = Guid.NewGuid().ToString(), Ignored = 2 }; using (var connection = this.GetConnection()) { connection.Open(); var inserted = (await connection.BulkInsertAndSelectAsync(new List <IdentityAndNotMappedTest> { item })).First(); IsValidInsert(inserted, item); } }
public void InsertSingleTransaction() { var item = new IdentityAndNotMappedTest { Name = Guid.NewGuid().ToString(), Ignored = 2 }; using (var connection = this.GetConnection()) { connection.Open(); using (var transaction = connection.BeginTransaction()) { var inserted = connection.BulkInsertAndSelect(new List <IdentityAndNotMappedTest> { item }, transaction).First(); IsValidInsert(inserted, item); } } }