public async Task Delete() { var dapper = new DapperImplementor(SqlHelper.GetSqlGenerator()); using (var connection = await _fixture.Factory.ConnectionFactory.CreateAsync()) { dapper.Delete(connection, new TestEntity() { Id = 1 }, null, null); Assert.Null(await dapper.GetAsync <TestEntity>(connection, 1, null, null)); Assert.Throws <ArgumentException>(() => dapper.Delete(connection, new TestClass(), null, null)); } }
public async Task DeleteWithCustomObject() { var dapper = new DapperImplementor(SqlHelper.GetSqlGenerator()); using (var connection = await _fixture.Factory.ConnectionFactory.CreateAsync()) { dapper.Delete <TestEntity>(connection, new { Id = 1, Name = "1" }, null, null); Assert.Null(await dapper.GetAsync <TestEntity>(connection, 1, null, null)); } }
public async Task DeleteWithPredicate() { var dapper = new DapperImplementor(SqlHelper.GetSqlGenerator()); using (var connection = await _fixture.Factory.ConnectionFactory.CreateAsync()) { var predicate = new FieldPredicate <TestEntity> { Operator = Operator.Eq, PropertyName = "Id", Value = 1 }; dapper.Delete <TestEntity>(connection, predicate, null, null); Assert.Null(await dapper.GetAsync <TestEntity>(connection, 1, null, null)); } }