public void TestSetCollection() { //---------------Set up test pack------------------- ListView listView = CreateListView(); ListViewCollectionManager controller = new ListViewCollectionManager(listView); BusinessObjectCollection <MyBO> col = GetColWith3Items(); //---------------Assert Precondition---------------- Assert.AreEqual(0, listView.Items.Count); //---------------Execute Test ---------------------- controller.SetCollection(col); //---------------Test Result ----------------------- Assert.AreEqual(3, listView.Items.Count); }
public void TestRemoveBoFromCollection() { ListView listView = CreateListView(); ListViewCollectionManager controller = new ListViewCollectionManager(listView); BusinessObjectCollection <MyBO> col = GetColWith3Items(); controller.SetCollection(col); //---------------Assert Precondition---------------- Assert.AreEqual(3, listView.Items.Count); //---------------Execute Test ---------------------- col.RemoveAt(0); //---------------Test Result ----------------------- Assert.AreEqual(2, listView.Items.Count); }
public void TestSetCollection_EmptyCollection() { //---------------Set up test pack------------------- ListViewCollectionManager cntrl = CreateDefaultListVievController(); BusinessObjectCollection <MyBO> col = new BusinessObjectCollection <MyBO>(); //---------------Execute Test ---------------------- cntrl.SetCollection(col); //---------------Test Result ----------------------- Assert.AreEqual(0, cntrl.ListView.Items.Count); //UIDef uiDef = GetDefaultUIDef(cntrl); //Assert.AreEqual(uiDef.GetUIGridProperties().Count, cntrl.ListView.Columns.Count);//There are 8 columns in the collection BO //Assert.IsNull(gridBase.SelectedBusinessObject); //---------------Tear Down ------------------------- }
public void TestGetBusinessObject() { ListView listView = CreateListView(); ListViewCollectionManager controller = new ListViewCollectionManager(listView); BusinessObjectCollection <MyBO> col = GetColWith3Items(); controller.SetCollection(col); //---------------Assert Precondition---------------- Assert.AreEqual(3, listView.Items.Count); //---------------Execute Test ---------------------- listView.Items[2].Selected = true; listView.Items[0].Focused = true; //---------------Test Result ----------------------- Assert.AreEqual(1, listView.SelectedItems.Count); Assert.IsNotNull(controller.SelectedBusinessObject); Assert.AreSame(col[2], controller.SelectedBusinessObject); }