34. [Test]
public void TestDeleteFlagsSetContactPerson()
{
ContactPerson myContact = new ContactPerson();
Assert.IsTrue(myContact.Status.IsNew); // this object is new
myContact.DateOfBirth = new DateTime(1980, 01, 20);
myContact.FirstName = "Bob";
myContact.Surname = "Smith";
myContact.Save(); //save the object to the DB
Assert.IsFalse(myContact.Status.IsNew); // this object is saved and thus no longer
// new
Assert.IsFalse(myContact.Status.IsDeleted);
IPrimaryKey id = myContact.ID; //Save the objectsID so that it can be loaded from the Data
Assert.AreEqual(id, myContact.ID);
myContact.MarkForDelete();
Assert.IsTrue(myContact.Status.IsDeleted);
myContact.Save();
Assert.IsTrue(myContact.Status.IsDeleted);
Assert.IsTrue(myContact.Status.IsNew);
}
34