private ThreeColumnEntity CreateThreeColumnEntity(int id) { var entity = new ThreeColumnEntity(); entity.IdCol = id; entity.Name = "3Col"; entity.IndexNo = 0; return(entity); }
public void PatchDifference_PatchDB_WithTableColumnChanged_ShouldUpdateColumn() { try { var longStr = new string('A', 220); ITransaction transaction = TransactionFactory.CreateTransaction(); ICollection <Type> types = new List <Type>(); types.Add(typeof(ThreeColumnEntity)); transaction.DbGate.PatchDataBase(transaction, types, true); transaction.Commit(); int id = 34; transaction = CreateTransaction(); ThreeColumnEntity columnEntity = CreateThreeColumnEntity(id); columnEntity.Name = longStr; try { columnEntity.Persist(transaction); } catch (AssertionException) { throw; } catch (System.Exception) { } transaction = CreateTransaction(); types = new List <Type>(); types.Add(typeof(ThreeColumnTypeDifferentEntity)); transaction.DbGate.PatchDataBase(transaction, types, false); transaction.Commit(); id = 35; transaction = CreateTransaction(); columnEntity = CreateThreeColumnEntity(id); columnEntity.Name = longStr; columnEntity.Persist(transaction); transaction.Commit(); } catch (System.Exception e) { LogManager.GetLogger(typeof(DbGatePatchTableDifferenceDbTests)).Fatal(e.Message, e); Assert.Fail(e.Message); } }