private void setParent(Task task, LiteItemModel parent) { if (parent.Id.HasValue) { Task newParent = session.Load<Task>(parent.Id); task.ChangeParent(newParent); } else { task.RemoveParent(); } }
public void RemoveParent() { Task parent = new Task(); Task child = new Task(); //child no parent child.RemoveParent(); Assert.That(child.Parent, Is.Null); parent.AddChild(child); //child have parent child.RemoveParent(); Assert.That(child.Parent, Is.Null); Assert.That(parent.Children.IsNullOrEmpty(), Is.True); }