示例#1
0
        public void TypeWithGenericParameterCanBeDeleted()
        {
            using (var connection = GetOpenConnection())
            {
                var objectToInsert = new GenericType <string>
                {
                    Id   = Guid.NewGuid().ToString(),
                    Name = "something"
                };
                connection.Insert(objectToInsert);

                bool deleted = connection.Delete(objectToInsert);
                Assert.True(deleted);
            }
        }
        public async Task TypeWithGenericParameterCanBeDeletedAsync()
        {
            using (var connection = GetOpenConnection())
            {
                var objectToInsert = new GenericType <string>
                {
                    Id   = Guid.NewGuid().ToString(),
                    Name = "something"
                };
                await connection.InsertAsync(objectToInsert);

                bool deleted = await connection.DeleteAsync(objectToInsert);

                Assert.True(deleted);
            }
        }
示例#3
0
        public void TypeWithGenericParameterCanBeUpdated()
        {
            using (var connection = GetOpenConnection())
            {
                var objectToInsert = new GenericType <string>
                {
                    Id   = Guid.NewGuid().ToString(),
                    Name = "something"
                };
                connection.Insert(objectToInsert);

                objectToInsert.Name = "somethingelse";
                connection.Update(objectToInsert);

                var updatedObject = connection.Get <GenericType <string> >(objectToInsert.Id);
                Assert.Equal(objectToInsert.Name, updatedObject.Name);
            }
        }