Beispiel #1
0
        public void InitializedList()
        {
            var dl = new List <TestItemDM> {
                new TestItemDM(0), new TestItemDM(1), new TestItemDM(2)
            };
            var bl = new ListBM <TestItemBM> {
                Metadata = { DataProvider = { Data = dl } }
            };
            var vl = new ListVM <TestItemVM> {
                Metadata = { DataProvider = { Data = bl } }
            };

            Assert.AreEqual(3, vl.Count);

            bl.RemoveAt(1);
            Assert.AreEqual(2, vl.Count);
            bl.Remove(bl[0]);
            Assert.AreEqual(1, vl.Count);
            bl.Clear();
            Assert.AreEqual(0, vl.Count);

            bl.Add(new TestItemBM {
                Metadata = { DataProvider = { Data = new TestItemDM(0) } }
            });
            Assert.AreEqual(1, vl.Count);
            bl.Insert(0, new TestItemBM {
                Metadata = { DataProvider = { Data = new TestItemDM(1) } }
            });
            Assert.AreEqual(2, vl.Count);
            bl.Insert(2, new TestItemBM {
                Metadata = { DataProvider = { Data = new TestItemDM(1) } }
            });
            Assert.AreEqual(3, vl.Count);
        }
Beispiel #2
0
        public void Clear_NoUnderlyingObject()
        {
            var bm = new ListBM <TestItemBM>();

            bm.Add(new TestItemBM());
            bm.Clear();
            Assert.AreEqual(0, bm.Count, "Count");
        }
Beispiel #3
0
        public void Clear_DefaultDataProvider_Array()
        {
            var dm = new [] { new TestItemDM(100), new TestItemDM(101) };
            var bm = new ListBM <TestItemBM> {
                MːData = dm
            };

            Assert.Throws <NotSupportedException>(() =>
                                                  bm.Clear()
                                                  );
        }
Beispiel #4
0
        public void Clear_DefaultDataProvider_List()
        {
            var dm = new List <TestItemDM>(new [] { new TestItemDM(100) });
            var bm = new ListBM <TestItemBM> {
                MːData = dm
            };

            bm.Clear();

            Assert.AreEqual(0, bm.Count, "Count");
            Assert.AreEqual(0, dm.Count, "Data.Count");
        }