Exemple #1
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);
        }
Exemple #2
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);
        }
Exemple #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();

            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);
        }
Exemple #4
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);
        }
Exemple #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);
        }
Exemple #6
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);
        }
Exemple #7
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);
        }
Exemple #8
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);
        }
Exemple #9
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);
        }