コード例 #1
0
ファイル: CollectionTests.cs プロジェクト: rnandikotkur/csla
        public void RootListGetRuleDescriptions()
        {
            RootList      list  = new RootList();
            RootListChild child = list.AddNew();

            string[] rules = child.GetRuleDescriptions();
        }
コード例 #2
0
        public void SuppressListChangedEventsDoNotRaiseCollectionChanged()
        {
            bool changed = false;
            var  obj     = new RootList();

            obj.ListChanged += (o, e) =>
            {
                changed = true;
            };
            var child = new RootListChild(); // object is marked as child

            Assert.IsTrue(obj.RaiseListChangedEvents);
            using (obj.SuppressListChangedEvents)
            {
                Assert.IsFalse(obj.RaiseListChangedEvents);

                obj.Add(child);
            }
            Assert.IsFalse(changed, "Should not raise ListChanged event");
            Assert.IsTrue(obj.RaiseListChangedEvents);
            Assert.AreEqual(child, obj[0]);
        }