private void store(ChildrenSortedList_Child newChild) { newChild.Store(); expectedChildren.Add(newChild.Key, newChild.ToString()); expectedParents[newChild.ParentWithSortedList.Key] = newChild.ParentWithSortedList.ToString(); var parentNullable = newChild.ParentWithSortedListNullable; if (parentNullable != null) { expectedParentsNullable[parentNullable.Key] = parentNullable.ToString(); } }
private ChildrenSortedList_Child addChild(ChildrenSortedList_Parent parent, ChildrenSortedList_ParentNullable?parentNullable, DateTime date, string text, bool isStoring) { //var newChild = new ChildrenSortedList_Child(date, text, parent, parentNullable, isStoring); //if (isStoring) { // expectedChildren.Add(newChild.Key, newChild.ToString()); // expectedParents[parent.Key] = parent.ToString(); // if (parentNullable!=null) { // expectedParentsNullable[parentNullable.Key] = parentNullable.ToString(); // } // assertData(); //} //return newChild; if (isStoring) { DC.Data.StartTransaction(); _ = new ChildrenSortedList_Child(date, text, parent, parentNullable, isStoring: true); DC.Data.RollbackTransaction(); assertData(); parent = DC.Data.ChildrenSortedList_Parents[parent.Key]; if (parentNullable != null) { parentNullable = DC.Data.ChildrenSortedList_ParentNullables[parentNullable.Key]; } DC.Data.StartTransaction(); var newChild = new ChildrenSortedList_Child(date, text, parent, parentNullable, isStoring: true); DC.Data.CommitTransaction(); expectedChildren.Add(newChild.Key, newChild.ToString()); expectedParents[parent.Key] = parent.ToString(); if (parentNullable != null) { expectedParentsNullable[parentNullable.Key] = parentNullable.ToString(); } assertData(); return(newChild); } else { return(new ChildrenSortedList_Child(date, text, parent, parentNullable, isStoring: false)); } }