public void PopulateAndUpdateNonExisting() { var tbl = new Table(Schema.GetForTypedRow(typeof(Person))); for(var i=0; i<1000; i++) tbl.Insert( new Person{ ID = "POP{0}".Args(i), FirstName = "Oleg", LastName = "Popov-{0}".Args(i), DOB = new DateTime(1953, 12, 10), YearsInSpace = 12 }); var update = new Person{ ID = "NONE17", FirstName = "Yaroslav", LastName = "Suzkever", DOB = new DateTime(1952, 12, 10), YearsInSpace = 14 }; var idx = tbl.Update(update);//<-------------!!!!!! Assert.IsTrue( idx==-1 ); var match = tbl.FindByKey("NONE17") as Person; Assert.IsNull( match ); }
public void LogChanges_Update() { var tbl = new Table(Schema.GetForTypedRow(typeof(Person))); tbl.Insert( new Person{ ID = "POP1", FirstName = "Oleg", LastName = "Popov", DOB = new DateTime(1953, 12, 10), YearsInSpace = 12 }); tbl.LogChanges = true; tbl.Update( tbl[0] ); Assert.AreEqual(1, tbl.ChangeCount); Assert.AreEqual(RowChangeType.Update, tbl.GetChangeAt(0).Value.ChangeType); }