public void LogChanges_Delete() { 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.Delete( tbl[0] ); Assert.AreEqual(1, tbl.ChangeCount); Assert.AreEqual(0, tbl.Count); Assert.AreEqual(RowChangeType.Delete, tbl.GetChangeAt(0).Value.ChangeType); }
public void PopulateAndDeleteNonExisting() { 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 delete = new Person{ ID = "NONE17" }; var idx = tbl.Delete( delete );//<-------------!!!!!! Assert.IsTrue( idx==-1 ); Assert.AreEqual(1000, tbl.Count); var match = tbl.FindByKey("POP17") as Person; Assert.IsNotNull( match ); }