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"); }
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"); }
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"); }
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); }
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); }
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); }
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); }
public void DeletedListTest() { 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.ApplyEdit(); 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); }
public void DeletedListTest() { 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.ApplyEdit(); 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); }
public void DeletedListTest() { 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.ApplyEdit(); 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); }
public void DeletedListTest() { #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.ApplyEdit(); 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); }
public void DeletedListTest() { 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.ApplyEdit(); Root copy = root.Clone(); var 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); }