Exemple #1
0
        private ChildrenSortedList_Parent addParent(string readOnlyText, string updateableText, bool isStoring)
        {
            //var newParent = new ChildrenSortedList_Parent(readOnlyText, updateableText, isStoring);
            //if (isStoring) {
            //  expectedParents.Add(newParent.Key, newParent.ToString());
            //  assertData();
            //}
            if (isStoring)
            {
                DC.Data.StartTransaction();
                _ = new ChildrenSortedList_Parent(readOnlyText, updateableText, isStoring);
                DC.Data.RollbackTransaction();
                assertData();

                DC.Data.StartTransaction();
                var newParent = new ChildrenSortedList_Parent(readOnlyText, updateableText, isStoring);
                DC.Data.CommitTransaction();
                expectedParents.Add(newParent.Key, newParent.ToString());
                assertData();
                return(newParent);
            }
            else
            {
                return(new ChildrenSortedList_Parent(readOnlyText, updateableText, isStoring));
            }
        }
Exemple #2
0
 private void updateExpected(ChildrenSortedList_Parent parent, ChildrenSortedList_ParentNullable?parentNullable)
 {
     expectedParents[parent.Key] = parent.ToString();
     foreach (var child in parent.ChildrenSortedList_Children.Values)
     {
         expectedChildren[child.Key] = child.ToString();
     }
     if (parentNullable != null)
     {
         expectedParentsNullable[parentNullable.Key] = parentNullable.ToString();
         foreach (var child in parentNullable.ChildrenSortedList_Children.Values)
         {
             expectedChildren[child.Key] = child.ToString();
         }
     }
 }
Exemple #3
0
        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));
            }
        }
Exemple #4
0
 private void store(ChildrenSortedList_Parent newParent)
 {
     newParent.Store();
     expectedParents.Add(newParent.Key, newParent.ToString());
 }