Example #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);
        }
Example #2
0
        public void RemoveAt_NoUnderlyingObject()
        {
            var bm = new ListBM <TestItemBM>();

            bm.Add(new TestItemBM());
            bm.RemoveAt(0);
            Assert.AreEqual(0, bm.Count, "Count");
        }
Example #3
0
        public void BusinessList_Enum_LocalDataProvider()
        {
            var list = new ListBM <EnumBM <TestEnum> >();

            list.Metadata.DataProvider.Data = new List <TestEnum>(new [] { TestEnum.A, TestEnum.B, TestEnum.C });
            list.Add(new EnumBM <TestEnum> {
                Metadata = { DataProvider = { Data = TestEnum.C } }
            });
            list.RemoveAt(0);
        }
Example #4
0
        public void BusinessList_Value_LocalDataProvider()
        {
            var list = new ListBM <StringBM>();

            list.Metadata.DataProvider.Data = new List <string>(new [] { "A", "B", "C" });
            list.Add(new StringBM {
                Metadata = { DataProvider = { Data = "D" } }
            });
            list.RemoveAt(0);
        }
Example #5
0
        public void RemoveAt_DefaultDataProvider_Array()
        {
            var dm = new [] { new TestItemDM(100), new TestItemDM(101) };
            var bm = new ListBM <TestItemBM> {
                MːData = dm
            };

            Assert.Throws <NotSupportedException>(() =>
                                                  bm.RemoveAt(0)
                                                  );
        }
Example #6
0
        public void RemoveAt_DefaultDataProvider_List()
        {
            var dm = new List <TestItemDM>(new [] { new TestItemDM(100) });
            var bm = new ListBM <TestItemBM> {
                MːData = dm
            };

            bm.RemoveAt(0);

            Assert.AreEqual(0, bm.Count, "Count");
            Assert.AreEqual(0, dm.Count, "Data.Count");
        }
Example #7
0
        public void BusinessList_Object_LocalDataProvider()
        {
            var list = new ListBM <TestObject>();

            list.Metadata.DataProvider.Data = new List <TestData>(new [] { new TestData {
                                                                               A = 1, B = "1", C = DateTime.Now
                                                                           }, new TestData {
                                                                               A = 2, B = "2", C = DateTime.Now
                                                                           } });
            list.Add(new TestObject {
                Metadata = { DataProvider           = { Data = new TestData {
                                                            A          = 3, B = "3", C = DateTime.Now
                                                        } } }
            });
            list.RemoveAt(0);
        }