public void TestPreventDelete() { //---------------Set up test pack------------------- DataStoreInMemory dataStoreInMemory = new DataStoreInMemory(); BORegistry.DataAccessor = new DataAccessorInMemory(dataStoreInMemory); AddressTestBO address; ContactPersonTestBO contactPersonTestBO = ContactPersonTestBO.CreateContactPersonWithOneAddress_PreventDelete(out address); // contactPersonTestBO.MarkForDelete(); ReflectionUtilities.SetPropertyValue(contactPersonTestBO.Status, "IsDeleted", true); ITransactionCommitter committer = new TransactionCommitterInMemory(dataStoreInMemory); committer.AddBusinessObject(contactPersonTestBO); //---------------Execute Test ---------------------- try { committer.CommitTransaction(); Assert.Fail("Expected to throw an BusObjPersistException"); } //---------------Test Result ----------------------- catch (BusObjPersistException ex) { StringAssert.Contains("You cannot delete ContactPersonTestBO", ex.Message); } }