/// <summary> /// Get delete plan for a given type /// </summary> /// <param name="type">Type</param> /// <returns>plan</returns> public virtual IOperationPlan GetDeletePlan(Type type) { var map = this._mappingManager.GetMapping(type); var delete = new DeletePlan(map, this._typeRegister); return(delete); }
/// <summary> /// Get delete plan for a given type /// </summary> /// <param name="type">Type</param> /// <returns>plan</returns> public virtual IOperationPlan GetDeletePlan(Type type) { var map = this._mappingManager.GetMapping(type); var delete = new DeletePlan(map, this._typeRegister); return delete; }
public void GetText_Returns_DeleteText() { var person = new Person(); var mapping = new PersonMap(); mapping.ExecuteMapping(); var mapInt = new TypeMap(DbType.Int32, typeof(int), new GenericConverter()); var mapString = new TypeMap(DbType.String, typeof(string), new GenericConverter()); var mock = new Moq.Mock<ITypeRegister>(); mock.Setup(x => x.Get(typeof(int))).Returns(mapInt); mock.Setup(x => x.Get(typeof(string))).Returns(mapString); var dbparam = new Moq.Mock<IDbDataParameter>(); Func<IDbDataParameter> func = () => dbparam.Object; var register = mock.Object; var insert = new DeletePlan(mapping, register); var param = insert.CreatePlanParameter(func, person); param.SqlText.ToUpper().Should().Be("DELETE FROM PERSON WHERE ID = @ID"); }