Example #1
0
        private CreateOnlyParentChangeableChild_Parent addParent(string text, bool isStoring)
        {
            //var newParent = new CreateOnlyParentChangeableChild_Parent(text, isStoring);
            //if (isStoring) {
            //  expectedParents.Add(newParent.Key, newParent.ToString());
            //  assertData();
            //}
            //return newParent;
            if (isStoring)
            {
                DC.Data.StartTransaction();
                new CreateOnlyParentChangeableChild_Parent(text, isStoring);
                DC.Data.RollbackTransaction();
                assertData();

                DC.Data.StartTransaction();
                var newParent = new CreateOnlyParentChangeableChild_Parent(text, isStoring);
                DC.Data.CommitTransaction();
                expectedParents.Add(newParent.Key, newParent.ToString());
                assertData();
                return(newParent);
            }
            else
            {
                return(new CreateOnlyParentChangeableChild_Parent(text, isStoring));
            }
        }
Example #2
0
 private void updateExpected(CreateOnlyParentChangeableChild_Parent newParent,
                             CreateOnlyParentChangeableChild_ParentNullable?newParentNullable)
 {
     expectedParents[newParent.Key] = newParent.ToString();
     foreach (var child in newParent.CreateOnlyParentChangeableChild_Children)
     {
         expectedChildren[child.Key] = child.ToString();
     }
     if (newParentNullable != null)
     {
         expectedParentsNullable[newParentNullable.Key] = newParentNullable.ToString();
         foreach (var child in newParentNullable.CreateOnlyParentChangeableChild_Children)
         {
             expectedChildren[child.Key] = child.ToString();
         }
     }
 }
Example #3
0
        private CreateOnlyParentChangeableChild_Child addChild(CreateOnlyParentChangeableChild_Parent parent,
                                                               CreateOnlyParentChangeableChild_ParentNullable?parentNullable, string readonlyText, string updatableText,
                                                               bool isStoring)
        {
            //var newChild = new CreateOnlyParentChangeableChild_Child(readonlyText, updatableText, 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 CreateOnlyParentChangeableChild_Child(readonlyText, updatableText, parent, parentNullable, isStoring: true);
                DC.Data.RollbackTransaction();
                assertData();

                parent = DC.Data.CreateOnlyParentChangeableChild_Parents[parent.Key];
                if (parentNullable != null)
                {
                    parentNullable = DC.Data.CreateOnlyParentChangeableChild_ParentNullables[parentNullable.Key];
                }
                DC.Data.StartTransaction();
                var newChild = new CreateOnlyParentChangeableChild_Child(readonlyText, updatableText, 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 CreateOnlyParentChangeableChild_Child(readonlyText, updatableText, parent, parentNullable, isStoring: false));
            }
        }
Example #4
0
 private void store(CreateOnlyParentChangeableChild_Parent newParent)
 {
     newParent.Store();
     expectedParents.Add(newParent.Key, newParent.ToString());
 }