Пример #1
0
        public void NestedAddDeleteAcceptChild()
        {
            TestResults.Reinitialise();

            Root root = CreateRootInstance();

            root.BeginEdit();
            root.Children.Add("A");
            root.BeginEdit();
            root.Children.Add("B");
            root.BeginEdit();
            root.Children.Add("C");
            Child childC = root.Children[2];

            Assert.AreEqual(true, root.Children.Contains(childC), "Child should be in collection");
            root.Children.Remove(root.Children[0]);
            root.Children.Remove(root.Children[0]);
            root.Children.Remove(root.Children[0]);
            Assert.AreEqual(false, root.Children.Contains(childC), "Child should not be in collection");
            Assert.AreEqual(true, root.Children.ContainsDeleted(childC), "Deleted child should be in deleted collection");
            root.ApplyEdit();
            Assert.AreEqual(false, root.Children.ContainsDeleted(childC), "Deleted child should not be in deleted collection after first applyedit");
            root.ApplyEdit();
            Assert.AreEqual(false, root.Children.ContainsDeleted(childC), "Deleted child should not be in deleted collection after ApplyEdit");
            root.ApplyEdit();
            Assert.AreEqual(0, root.Children.Count, "No children should remain");
            Assert.AreEqual(false, root.Children.ContainsDeleted(childC), "Deleted child should not be in deleted collection after third applyedit");
        }
Пример #2
0
        public void NestedAddDeleteAcceptChild()
        {
            IDataPortal <Child> childDataPortal = _testDIContext.CreateDataPortal <Child>();

            TestResults.Reinitialise();
            Root root = NewRoot();

            root.BeginEdit();
            root.Children.Add(childDataPortal, "A");
            root.BeginEdit();
            root.Children.Add(childDataPortal, "B");
            root.BeginEdit();
            root.Children.Add(childDataPortal, "C");
            Child childC = root.Children[2];

            Assert.AreEqual(true, root.Children.Contains(childC), "Child should be in collection");
            root.Children.Remove(root.Children[0]);
            root.Children.Remove(root.Children[0]);
            root.Children.Remove(root.Children[0]);
            Assert.AreEqual(false, root.Children.Contains(childC), "Child should not be in collection");
            Assert.AreEqual(true, root.Children.ContainsDeleted(childC), "Deleted child should be in deleted collection");
            root.ApplyEdit();
            Assert.AreEqual(false, root.Children.ContainsDeleted(childC), "Deleted child should not be in deleted collection after first applyedit");
            root.ApplyEdit();
            Assert.AreEqual(false, root.Children.ContainsDeleted(childC), "Deleted child should not be in deleted collection after ApplyEdit");
            root.ApplyEdit();
            Assert.AreEqual(0, root.Children.Count, "No children should remain");
            Assert.AreEqual(false, root.Children.ContainsDeleted(childC), "Deleted child should not be in deleted collection after third applyedit");
        }
Пример #3
0
        public void NestedAddDeleteAcceptChild()
        {
            Csla.ApplicationContext.GlobalContext.Clear();
            Root root = Csla.Test.Basic.Root.NewRoot();

            root.BeginEdit();
            root.Children.Add("A");
            root.BeginEdit();
            root.Children.Add("B");
            root.BeginEdit();
            root.Children.Add("C");
            Child childC = root.Children[2];

            Assert.AreEqual(true, root.Children.Contains(childC), "Child should be in collection");
            root.Children.Remove(root.Children[0]);
            root.Children.Remove(root.Children[0]);
            root.Children.Remove(root.Children[0]);
            Assert.AreEqual(false, root.Children.Contains(childC), "Child should not be in collection");
            Assert.AreEqual(true, root.Children.ContainsDeleted(childC), "Deleted child should be in deleted collection");
            root.ApplyEdit();
            Assert.AreEqual(false, root.Children.ContainsDeleted(childC), "Deleted child should not be in deleted collection after first applyedit");
            root.ApplyEdit();
            Assert.AreEqual(false, root.Children.ContainsDeleted(childC), "Deleted child should not be in deleted collection after ApplyEdit");
            root.ApplyEdit();
            Assert.AreEqual(0, root.Children.Count, "No children should remain");
            Assert.AreEqual(false, root.Children.ContainsDeleted(childC), "Deleted child should not be in deleted collection after third applyedit");
        }
Пример #4
0
        public void DeletedListTestWithCancel()
        {
            IDataPortal <Child> childDataPortal = _testDIContext.CreateDataPortal <Child>();

            TestResults.Reinitialise();
            Root root = NewRoot();

            root.Children.Add(childDataPortal, "1");
            root.Children.Add(childDataPortal, "2");
            root.Children.Add(childDataPortal, "3");
            root.BeginEdit();
            root.Children.Remove(root.Children[0]);
            root.Children.Remove(root.Children[0]);

            Root copy = root.Clone();

            List <Child> deleted = (List <Child>)(root.Children.GetType().GetProperty("DeletedList", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.FlattenHierarchy | System.Reflection.BindingFlags.IgnoreCase).GetValue(copy.Children, null));

            Assert.AreEqual(2, deleted.Count);
            Assert.AreEqual("1", deleted[0].Data);
            Assert.AreEqual("2", deleted[1].Data);
            Assert.AreEqual(1, root.Children.Count);

            root.CancelEdit();

            deleted = (List <Child>)(root.Children.GetType().GetProperty("DeletedList", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.FlattenHierarchy | System.Reflection.BindingFlags.IgnoreCase).GetValue(root.Children, null));

            Assert.AreEqual(0, deleted.Count);
            Assert.AreEqual(3, root.Children.Count);
        }
Пример #5
0
        public void DeletedListTestWithCancel()
        {
            Csla.ApplicationContext.GlobalContext.Clear();
            Root root = Csla.Test.Basic.Root.NewRoot();

            root.Children.Add("1");
            root.Children.Add("2");
            root.Children.Add("3");
            root.BeginEdit();
            root.Children.Remove(root.Children[0]);
            root.Children.Remove(root.Children[0]);

            Root copy = root.Clone();

            List <Child> deleted = (List <Child>)(root.Children.GetType().GetProperty("DeletedList", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.FlattenHierarchy | System.Reflection.BindingFlags.IgnoreCase).GetValue(copy.Children, null));

            Assert.AreEqual(2, deleted.Count);
            Assert.AreEqual("1", deleted[0].Data);
            Assert.AreEqual("2", deleted[1].Data);
            Assert.AreEqual(1, root.Children.Count);

            root.CancelEdit();

            deleted = (List <Child>)(root.Children.GetType().GetProperty("DeletedList", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.FlattenHierarchy | System.Reflection.BindingFlags.IgnoreCase).GetValue(root.Children, null));

            Assert.AreEqual(0, deleted.Count);
            Assert.AreEqual(3, root.Children.Count);
        }
Пример #6
0
        public void NestedAddAcceptchild()
        {
            Csla.ApplicationContext.GlobalContext.Clear();
            Root root = Csla.Test.Basic.Root.NewRoot();

            root.BeginEdit();
            root.Children.Add("A");
            root.BeginEdit();
            root.Children.Add("B");
            root.BeginEdit();
            root.Children.Add("C");
            root.ApplyEdit();
            root.ApplyEdit();
            root.ApplyEdit();
            Assert.AreEqual(3, root.Children.Count);
        }
Пример #7
0
        public void DeletedListTestWithCancel()
        {
            TestResults.Reinitialise();

            Root root = CreateRootInstance();

            root.Children.Add("1");
            root.Children.Add("2");
            root.Children.Add("3");
            root.BeginEdit();
            root.Children.Remove(root.Children[0]);
            root.Children.Remove(root.Children[0]);

            Root copy = root.Clone();

            var deleted = copy.Children.GetDeletedList();

            Assert.AreEqual(2, deleted.Count);
            Assert.AreEqual("1", deleted[0].Data);
            Assert.AreEqual("2", deleted[1].Data);
            Assert.AreEqual(1, root.Children.Count);

            root.CancelEdit();

            deleted = root.Children.GetDeletedList();

            Assert.AreEqual(0, deleted.Count);
            Assert.AreEqual(3, root.Children.Count);
        }
Пример #8
0
        public void DeletedListTestWithCancel()
        {
            Csla.ApplicationContext.GlobalContext.Clear();
            Root root = Csla.Test.Basic.Root.NewRoot();

            root.Children.Add("1");
            root.Children.Add("2");
            root.Children.Add("3");
            root.BeginEdit();
            root.Children.Remove(root.Children[0]);
            root.Children.Remove(root.Children[0]);

            Root copy = root.Clone();

            var deleted = copy.Children.GetDeletedList();

            Assert.AreEqual(2, deleted.Count);
            Assert.AreEqual("1", deleted[0].Data);
            Assert.AreEqual("2", deleted[1].Data);
            Assert.AreEqual(1, root.Children.Count);

            root.CancelEdit();

            deleted = root.Children.GetDeletedList();

            Assert.AreEqual(0, deleted.Count);
            Assert.AreEqual(3, root.Children.Count);
        }
Пример #9
0
        public void DeletedListTestWithCancel()
        {
#pragma warning disable CS0618 // Type or member is obsolete
            Csla.ApplicationContext.GlobalContext.Clear();
#pragma warning restore CS0618 // Type or member is obsolete
            Root root = Csla.Test.Basic.Root.NewRoot();
            root.Children.Add("1");
            root.Children.Add("2");
            root.Children.Add("3");
            root.BeginEdit();
            root.Children.Remove(root.Children[0]);
            root.Children.Remove(root.Children[0]);

            Root copy = root.Clone();

            var deleted = copy.Children.GetDeletedList();

            Assert.AreEqual(2, deleted.Count);
            Assert.AreEqual("1", deleted[0].Data);
            Assert.AreEqual("2", deleted[1].Data);
            Assert.AreEqual(1, root.Children.Count);

            root.CancelEdit();

            deleted = root.Children.GetDeletedList();

            Assert.AreEqual(0, deleted.Count);
            Assert.AreEqual(3, root.Children.Count);
        }
Пример #10
0
        public void NestedAddAcceptchild()
        {
            TestResults.Reinitialise();

            Root root = CreateRootInstance();

            root.BeginEdit();
            root.Children.Add("A");
            root.BeginEdit();
            root.Children.Add("B");
            root.BeginEdit();
            root.Children.Add("C");
            root.ApplyEdit();
            root.ApplyEdit();
            root.ApplyEdit();
            Assert.AreEqual(3, root.Children.Count);
        }
Пример #11
0
        public void NestedAddAcceptchild()
        {
#pragma warning disable CS0618 // Type or member is obsolete
            Csla.ApplicationContext.GlobalContext.Clear();
#pragma warning restore CS0618 // Type or member is obsolete
            Root root = Csla.Test.Basic.Root.NewRoot();
            root.BeginEdit();
            root.Children.Add("A");
            root.BeginEdit();
            root.Children.Add("B");
            root.BeginEdit();
            root.Children.Add("C");
            root.ApplyEdit();
            root.ApplyEdit();
            root.ApplyEdit();
            Assert.AreEqual(3, root.Children.Count);
        }
Пример #12
0
        public void NestedAddAcceptchild()
        {
            IDataPortal <Child> childDataPortal = _testDIContext.CreateDataPortal <Child>();

            TestResults.Reinitialise();
            Root root = NewRoot();

            root.BeginEdit();
            root.Children.Add(childDataPortal, "A");
            root.BeginEdit();
            root.Children.Add(childDataPortal, "B");
            root.BeginEdit();
            root.Children.Add(childDataPortal, "C");
            root.ApplyEdit();
            root.ApplyEdit();
            root.ApplyEdit();
            Assert.AreEqual(3, root.Children.Count);
        }
Пример #13
0
        public void AddRemoveAddChild()
        {
            Csla.ApplicationContext.GlobalContext.Clear();
            Root root = Csla.Test.Basic.Root.NewRoot();

            root.Children.Add("1");
            root.BeginEdit();
            root.Children.Remove(root.Children[0]);

            root.Children.Add("2");
            root.CancelEdit();

            Assert.AreEqual(1, root.Children.Count);
            Assert.AreEqual("1", root.Children[0].Data);
        }
Пример #14
0
        public void AddRemoveAddChild()
        {
            TestResults.Reinitialise();

            Root root = CreateRootInstance();

            root.Children.Add("1");
            root.BeginEdit();
            root.Children.Remove(root.Children[0]);

            root.Children.Add("2");
            root.CancelEdit();

            Assert.AreEqual(1, root.Children.Count);
            Assert.AreEqual("1", root.Children[0].Data);
        }
Пример #15
0
        public void AddRemoveAddChild()
        {
#pragma warning disable CS0618 // Type or member is obsolete
            Csla.ApplicationContext.GlobalContext.Clear();
#pragma warning restore CS0618 // Type or member is obsolete
            Root root = Csla.Test.Basic.Root.NewRoot();
            root.Children.Add("1");
            root.BeginEdit();
            root.Children.Remove(root.Children[0]);

            root.Children.Add("2");
            root.CancelEdit();

            Assert.AreEqual(1, root.Children.Count);
            Assert.AreEqual("1", root.Children[0].Data);
        }
Пример #16
0
        public void AddRemoveAddChild()
        {
            IDataPortal <Child> childDataPortal = _testDIContext.CreateDataPortal <Child>();

            TestResults.Reinitialise();
            Root root = NewRoot();

            root.Children.Add(childDataPortal, "1");
            root.BeginEdit();
            root.Children.Remove(root.Children[0]);

            root.Children.Add(childDataPortal, "2");
            root.CancelEdit();

            Assert.AreEqual(1, root.Children.Count);
            Assert.AreEqual("1", root.Children[0].Data);
        }