public static void AssertGeneratedInsertSql(this ITriggerProvider provider, string sql, Expression <Func <SourceEntity, DestinationEntity> > expression) { var trigger = new OnInsertTriggerInsertAction <SourceEntity, DestinationEntity>(expression); var generatedSql = trigger.BuildSql(provider); Assert.Equal(sql, generatedSql); }
public virtual void DecimalAddSql() { var action = new OnInsertTriggerInsertAction <TestEntity, TestEntity>(t => new TestEntity { DecimalValue = t.DecimalValue + 3 }); var sql = action.BuildSql(Visitor); Assert.Equal(ExceptedDecimalAddSql, sql); }
public virtual void EnumValueSql() { var action = new OnInsertTriggerInsertAction <Transaction, User>(transaction => new User { Role = UserRole.Admin }); var sql = action.BuildSql(Visitor); Assert.Equal(ExceptedEnumValueSql, sql); }
public virtual void StringUpperSql() { var sql = new OnInsertTriggerInsertAction <Transaction, TransactionMirror>(transaction => new TransactionMirror { Description = transaction.Description.ToUpper() }).BuildSql(Visitor); Assert.Equal(ExceptedStringUpperSql, sql); }
public virtual void IntMultiplySql() { var action = new OnInsertTriggerInsertAction <TestEntity, TestEntity>(t => new TestEntity { IntValue = t.IntValue * 2 }); var sql = action.BuildSql(Visitor); Assert.Equal(ExceptedIntMultiplySql, sql); }
public virtual void MathFloorTwoSql() { var sql = new OnInsertTriggerInsertAction <Transaction, TransactionMirror>(transaction => new TransactionMirror { DoubleValue = Math.Floor(transaction.DoubleValue), }).BuildSql(Visitor); Assert.Equal(ExceptedFloorSql, sql); }
public virtual void MathAbsSql() { var sql = new OnInsertTriggerInsertAction <Transaction, TransactionMirror>(transaction => new TransactionMirror { Value = Math.Abs(transaction.Value), }).BuildSql(Visitor); Assert.Equal(ExceptedAbsSql, sql); }
public virtual void StringIsNullOrEmptySql() { var sql = new OnInsertTriggerInsertAction <Transaction, TransactionMirror>(transaction => new TransactionMirror { IsVeryfied = string.IsNullOrEmpty(transaction.Description), }).BuildSql(Visitor); Assert.Equal(ExceptedIsNullOrEmptySql, sql); }
public virtual void StringEndsWithSql() { var sql = new OnInsertTriggerInsertAction <Transaction, TransactionMirror>(transaction => new TransactionMirror { IsVeryfied = transaction.Description.EndsWith("abc"), }).BuildSql(Visitor); Assert.Equal(ExceptedEndsWithSql, sql); }
public virtual void NewGuid() { var action = new OnInsertTriggerInsertAction <TestEntity, TestEntity>(t => new TestEntity { GuidValue = new Guid() }); var sql = action.BuildSql(Visitor); Assert.Equal(ExceptedNewGuidSql, sql); }
public virtual void BooleanValueSql() { var action = new OnInsertTriggerInsertAction <TestEntity, TestEntity>(t => new TestEntity { BooleanValue = true }); var sql = action.BuildSql(Visitor); Assert.Equal(ExceptedBooleanSql, sql); }