示例#1
0
        public void Blb2Loc_Add()
        {
            var source = new TestList();
            var query  = from r in source
                         where r.Id > 100
                         select r;
            var synced = source.ToSyncList(query);

            var newItem = Csla.DataPortal.FetchChild <TestItem>(432, "New item");

            synced.Add(newItem);

            Assert.AreEqual(4, synced.Count, "synced should have item");
            Assert.AreEqual(5, source.Count, "source should have item");
            Assert.IsTrue(synced.Contains(newItem), "synced should contain new item");
            Assert.IsTrue(source.Contains(newItem), "source should contain new item");
        }
示例#2
0
        public void Blb2Loc_Remove()
        {
            var source = new TestList();
            var query  = from r in source
                         where r.Id > 100
                         select r;
            var synced = source.ToSyncList(query);

            var oldItem = synced[0];

            synced.RemoveAt(0);

            Assert.AreEqual(2, synced.Count, "synced count wrong");
            Assert.AreEqual(3, source.Count, "source count wrong");
            Assert.IsFalse(synced.Contains(oldItem), "synced should not contain item");
            Assert.IsFalse(source.Contains(oldItem), "source should not contain item");
        }