public void Test_IsDeletable_WhenSingle_WhenHasRelatedBO_WhenPreventDelete_WhenRelatedBOMarked4Delete_ShouldReturnTrue() { //---------------Set up test pack------------------- BORegistry.DataAccessor = new DataAccessorInMemory(); ClassDef.ClassDefs.Clear(); IClassDef classDef = MyBO.LoadClassDefWithRelationship(); MyRelatedBo.LoadClassDef(); MyBO bo = (MyBO)classDef.CreateNewBusinessObject(); bo.Save(); SingleRelationship<MyRelatedBo> relationship = (SingleRelationship<MyRelatedBo>) bo.Relationships["MyRelationship"]; MyRelatedBo myRelatedBO = new MyRelatedBo(); relationship.SetRelatedObject(myRelatedBO); myRelatedBO.MarkForDelete(); //---------------Assert Precondition---------------- Assert.IsFalse(bo.Status.IsDeleted); Assert.IsFalse(bo.Status.IsNew); Assert.IsTrue(bo.Status.IsDirty); Assert.IsTrue(bo.Status.IsEditing); Assert.IsNotNull(relationship.GetRelatedObject()); Assert.AreEqual(DeleteParentAction.Prevent, relationship.DeleteParentAction); //---------------Execute Test ---------------------- string message; bool isDeletable = bo.IsDeletable(out message); //---------------Test Result ----------------------- Assert.IsTrue(isDeletable); }