Beispiel #1
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);
        }
Beispiel #2
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);
        }
Beispiel #3
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);
        }
Beispiel #4
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);
        }
Beispiel #5
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);
        }