public void ListVM_Contains_Empty_BusinessList() { var dl = new List <TestItemDM>(); var bl = new ListBM <TestItemBM> { Metadata = { DataProvider = { Data = dl } } }; var vl = new ListVM <TestItemVM> { Metadata = { DataProvider = { Data = bl } } }; var di = (TestItemDM)null; var vi = (TestItemVM)null; Assert.AreEqual(false, vl.IsReadOnly); Assert.AreEqual(false, ((IList)vl).IsFixedSize); vl.Add(vi = new TestItemVM { Metadata = { DataProvider = { Data = new TestItemBM { Metadata = { DataProvider= { Data= di = new TestItemDM(0) } } } } } }); Assert.AreEqual(1, bl.Count); Assert.AreEqual(1, dl.Count); Assert.AreEqual(0, vl.IndexOf(vi)); Assert.AreEqual(0, ((IList)vl).IndexOf(vi)); Assert.AreEqual(true, ((IList)vl).Contains(vi)); Assert.AreEqual(vi, vl[0]); Assert.AreEqual(vi, ((IList)vl)[0]); vl.Add(new TestItemVM { Metadata = { DataProvider = { Data = new TestItemBM { Metadata = { DataProvider= { Data= new TestItemDM(1) } } } } } }); Assert.AreEqual(2, dl.Count); vl.Add(new TestItemVM { Metadata = { DataProvider = { Data = new TestItemBM { Metadata = { DataProvider= { Data= new TestItemDM(2) } } } } } }); Assert.AreEqual(3, dl.Count); vl.RemoveAt(1); Assert.AreEqual(2, dl.Count); vl.Remove(vi); Assert.AreEqual(1, dl.Count); vl.Clear(); Assert.AreEqual(0, dl.Count); vl.Insert(0, new TestItemVM { Metadata = { DataProvider = { Data = new TestItemBM { Metadata = { DataProvider= { Data= new TestItemDM(0) } } } } } }); vl.Insert(0, new TestItemVM { Metadata = { DataProvider = { Data = new TestItemBM { Metadata = { DataProvider= { Data= new TestItemDM(1) } } } } } }); vl.Insert(2, new TestItemVM { Metadata = { DataProvider = { Data = new TestItemBM { Metadata = { DataProvider= { Data= new TestItemDM(2) } } } } } }); Assert.AreEqual(3, dl.Count); foreach (var item in vl) { Assert.IsTrue(vl.Contains(item)); } foreach (var item in (IEnumerable)vl) { Assert.IsTrue(vl.Contains(item)); } vl.CopyTo(new TestItemVM[3], 0); vl[0] = TestItemVM.New(); ((IList)vl)[0] = TestItemVM.New(); vl.Move(0, 2); vl.Dispose(); }