/// <summary> /// Tests for issue #351 /// </summary> public async Task InsertGetUpdateDeleteWithExplicitKey() { using (var connection = GetOpenConnection()) { var guid = Guid.NewGuid().ToString(); var o1 = new ObjectX { ObjectXId = guid, Name = "Foo" }; await connection.InsertAsync(o1); var list1 = (await connection.QueryAsync <ObjectX>("select * from objectx")).ToList(); list1.Count.IsEqualTo(1); o1 = await connection.GetAsync <ObjectX>(guid); o1.ObjectXId.IsEqualTo(guid); o1.Name = "Bar"; await connection.UpdateAsync(o1); o1 = await connection.GetAsync <ObjectX>(guid); o1.Name.IsEqualTo("Bar"); await connection.DeleteAsync(o1); o1 = await connection.GetAsync <ObjectX>(guid); o1.IsNull(); const int id = 42; var o2 = new ObjectY() { ObjectYId = id, Name = "Foo" }; await connection.InsertAsync(o2); var list2 = (await connection.QueryAsync <ObjectY>("select * from objecty")).ToList(); list2.Count.IsEqualTo(1); o2 = await connection.GetAsync <ObjectY>(id); o2.ObjectYId.IsEqualTo(id); o2.Name = "Bar"; await connection.UpdateAsync(o2); o2 = await connection.GetAsync <ObjectY>(id); o2.Name.IsEqualTo("Bar"); await connection.DeleteAsync(o2); o2 = await connection.GetAsync <ObjectY>(id); o2.IsNull(); } }
/// <summary> /// Tests for issue #351 /// </summary> public async Task InsertGetUpdateDeleteWithExplicitKey() { using (var connection = GetOpenConnection()) { var guid = Guid.NewGuid().ToString(); var o1 = new ObjectX { ObjectXId = guid, Name = "Foo" }; await connection.InsertAsync(o1); var list1 = (await connection.QueryAsync<ObjectX>("select * from objectx")).ToList(); list1.Count.IsEqualTo(1); o1 = await connection.GetAsync<ObjectX>(guid); o1.ObjectXId.IsEqualTo(guid); o1.Name = "Bar"; await connection.UpdateAsync(o1); o1 = await connection.GetAsync<ObjectX>(guid); o1.Name.IsEqualTo("Bar"); await connection.DeleteAsync(o1); o1 = await connection.GetAsync<ObjectX>(guid); o1.IsNull(); const int id = 42; var o2 = new ObjectY() { ObjectYId = id, Name = "Foo" }; await connection.InsertAsync(o2); var list2 = (await connection.QueryAsync<ObjectY>("select * from objecty")).ToList(); list2.Count.IsEqualTo(1); o2 = await connection.GetAsync<ObjectY>(id); o2.ObjectYId.IsEqualTo(id); o2.Name = "Bar"; await connection.UpdateAsync(o2); o2 = await connection.GetAsync<ObjectY>(id); o2.Name.IsEqualTo("Bar"); await connection.DeleteAsync(o2); o2 = await connection.GetAsync<ObjectY>(id); o2.IsNull(); } }