public void Test02TrackedEntitiesUpdateOk() { using (var db = new AdventureWorksLt2012()) { //SETUP var description = db.ProductDescriptions.OrderByDescending(x => x.ProductDescriptionID).First(); var originalGuid = description.rowguid; //ATTEMPT description.Description = Guid.NewGuid().ToString(); var status = db.SaveChangesWithChecking(); //VERIFY status.IsValid.ShouldEqual(true, status.Errors); description.ModifiedDate.Ticks.ShouldEqualWithTolerance(DateTime.UtcNow.Ticks, HalfSecondInTicks); description.rowguid.ShouldEqual(originalGuid); } }
public void Test01TrackedEntitiesAddOk() { using (var db = new AdventureWorksLt2012()) { //SETUP var description = new ProductDescription { Description = Guid.NewGuid().ToString() }; //ATTEMPT db.ProductDescriptions.Add(description); var status = db.SaveChangesWithChecking(); //VERIFY status.IsValid.ShouldEqual(true, status.Errors); description.ModifiedDate.Ticks.ShouldEqualWithTolerance(DateTime.UtcNow.Ticks, HalfSecondInTicks); description.rowguid.ShouldNotEqual( new Guid()); } }