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