public void PerformUpdate() { var reportsToRef = Entity.Get <Relationship>(new EntityRef("test:reportsTo")); var personType = Entity.Get <Definition>(new EntityRef("test:employee")); var mgr = Entity.Create(new EntityRef("test:manager")); Action <IEntity> updateAction = (wfr) => wfr.SetRelationships(reportsToRef, new EntityRelationshipCollection <IEntity> { mgr }); var emp = Entity.Create(new EntityRef("test:employee")); emp.Save(); UpdateFieldImplementation.PerformUpdate(emp, updateAction); }
public void PerformUpdateWithRefToInvalidResource() { using (var ctx = DatabaseContext.GetContext(true)) { var mgr1 = Entity.Create(new EntityRef("test:manager")); mgr1.Save(); Entity.Delete(mgr1.Id); var reportsToRef = Entity.Get <Relationship>(new EntityRef("test:reportsTo")); var personType = Entity.Get <Definition>(new EntityRef("test:employee")); Action <IEntity> updateAction = (wfr) => wfr.SetRelationships(reportsToRef, new EntityRelationshipCollection <IEntity> { mgr1 }); var emp = Entity.Create(new EntityRef("test:employee")); emp.Save(); UpdateFieldImplementation.PerformUpdate(emp, updateAction); } }