public void ContainedList() { int lc = 0; int rcc = 0; int cc = 0; Csla.Core.ChildChangedEventArgs cca = null; var root = new ContainsList(); root.List.Add(new SingleRoot(true)); root.PropertyChanged += (o, e) => { Assert.IsTrue(false, "root.PropertyChanged should not fire"); }; root.ChildChanged += (o, e) => { rcc++; }; #if !SILVERLIGHT System.ComponentModel.PropertyDescriptor lcp = null; root.List.ListChanged += (o, e) => { lc++; lcp = e.PropertyDescriptor; }; #else root.List.CollectionChanged += (o, e) => { lc++; }; #endif root.List.ChildChanged += (o, e) => { cc++; cca = e; }; root.List[0].Name = "abc"; #if !SILVERLIGHT Assert.AreEqual(1, lc, "ListChanged should have fired"); Assert.IsNotNull(lcp, "PropertyDescriptor should be provided"); Assert.AreEqual("Name", lcp.Name, "PropertyDescriptor.Name should be Name"); #endif Assert.AreEqual(1, rcc, "root.ChildChanged should have fired"); Assert.AreEqual(1, cc, "list.ChildChanged should have fired"); Assert.IsTrue(ReferenceEquals(root.List[0], cca.ChildObject), "Ref should be equal"); }
public void ReloadTables() { if (_source != null && CurrentGroup != null) { ContainsList.Clear(); DoesntContainList.Clear(); var doesntContainCollection = from layer in _source.Layers where (!CurrentGroup.Tables.Contains(layer) && !layer.IsHidden) select layer as PgM.PgTableBaseM; foreach (PgM.PgTableBaseM pgTable in CurrentGroup.Tables) { _containsList.Add(pgTable); } foreach (PgM.PgTableBaseM pgTable in doesntContainCollection) { _doesntContainList.Add(pgTable); } } else { DoesntContainList.Clear(); ContainsList.Clear(); } }
public void ListOfLists() { bool rcc = false; bool ccc = false; bool cc = false; Csla.Core.ChildChangedEventArgs cca = null; var root = new ListContainerList(); var child = new ContainsList(true); root.Add(child); child.List.Add(new SingleRoot(true)); root.ChildChanged += (o, e) => { rcc = true; }; #if !SILVERLIGHT System.ComponentModel.PropertyDescriptor lcp = null; root.ListChanged += (o, e) => { Assert.Fail("root.ListChanged should not fire"); }; #else root.CollectionChanged += (o, e) => { Assert.IsTrue(false, "root.ListChanged should not fire"); }; #endif child.ChildChanged += (o, e) => { ccc = true; }; child.PropertyChanged += (o, e) => { Assert.IsTrue(false, "child.PropertyChanged should not fire"); }; #if !SILVERLIGHT bool lc = false; child.List.ListChanged += (o, e) => { lc = true; lcp = e.PropertyDescriptor; }; #endif child.List.ChildChanged += (o, e) => { cc = true; cca = e; }; child.List[0].Name = "abc"; #if !SILVERLIGHT Assert.IsTrue(lc, "ListChanged should have fired"); Assert.IsNotNull(lcp, "PropertyDescriptor should be provided"); Assert.AreEqual("Name", lcp.Name, "PropertyDescriptor.Name should be Name"); #endif Assert.IsTrue(rcc, "root.ChildChanged should have fired"); Assert.IsTrue(ccc, "child.ChildChanged should have fired"); Assert.IsTrue(cc, "list.ChildChanged should have fired"); Assert.IsTrue(ReferenceEquals(child.List[0], cca.ChildObject), "Ref should be equal"); }