コード例 #1
0
 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);
 }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        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);
                }
            }
        }