private void updateExpected(ChildrenDictionary_Parent parent, ChildrenDictionary_ParentNullable?parentNullable)
 {
     expectedParents[parent.Key] = parent.ToString();
     foreach (var child in parent.ChildrenDictionary_Children.Values)
     {
         expectedChildren[child.Key] = child.ToString();
     }
     if (parentNullable != null)
     {
         expectedParentsNullable[parentNullable.Key] = parentNullable.ToString();
         foreach (var child in parentNullable.ChildrenDictionary_Children.Values)
         {
             expectedChildren[child.Key] = child.ToString();
         }
     }
 }
        private ChildrenDictionary_Child addChild(ChildrenDictionary_Parent parent, ChildrenDictionary_ParentNullable?parentNullable,
                                                  DateTime date, string text, bool isStoring)
        {
            //var newChild = new ChildrenDictionary_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 ChildrenDictionary_Child(date, text, parent, parentNullable, isStoring: true);
                DC.Data.RollbackTransaction();
                assertData();

                parent = DC.Data.ChildrenDictionary_Parents[parent.Key];
                if (parentNullable != null)
                {
                    parentNullable = DC.Data.ChildrenDictionary_ParentNullables[parentNullable.Key];
                }
                DC.Data.StartTransaction();
                var newChild = new ChildrenDictionary_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 ChildrenDictionary_Child(date, text, parent, parentNullable, isStoring: false));
            }
        }
        private ChildrenDictionary_Parent addParent(string someText, bool isStoring)
        {
            if (isStoring)
            {
                DC.Data.StartTransaction();
                new ChildrenDictionary_Parent(someText, isStoring);
                DC.Data.RollbackTransaction();
                assertData();

                DC.Data.StartTransaction();
                var newParent = new ChildrenDictionary_Parent(someText, isStoring);
                DC.Data.CommitTransaction();
                expectedParents.Add(newParent.Key, newParent.ToString());
                assertData();
                return(newParent);
            }
            else
            {
                return(new ChildrenDictionary_Parent(someText, isStoring));
            }
        }
 private void store(ChildrenDictionary_Parent newParent)
 {
     newParent.Store();
     expectedParents.Add(newParent.Key, newParent.ToString());
 }