public void can_clearUnderlyingList()
        {
            ListControl webList = new DropDownList();
            webList.Items.Add(new ListItem("1", "1"));

            ILookupList list = new WebLookupList(webList);
            list.clear();
            Assert.AreEqual(0, webList.Items.Count);
        }
        public void can_addItemToUnderlyingList()
        {
            ListControl webList = new DropDownList();
            ILookupList list = new WebLookupList(webList);

            SimpleLookupDTO dto = new SimpleLookupDTO("1", "1");
            list.add(dto);

            Assert.AreEqual(1, webList.Items.Count);
            Assert.AreEqual(dto.Value, webList.Items[0].Value);
            Assert.AreEqual(dto.Text, webList.Items[0].Text);
        }
        public void can_getSelectedItem_AsLookupDTO()
        {
            ListControl webList = new DropDownList();

            ListItem listItem = new ListItem("1","1");
            webList.Items.Add(listItem);
            webList.SelectedIndex = 0;

            ILookupList list = new WebLookupList(webList);
            ILookupDTO dto = list.SelectedItem;

            Assert.AreEqual(listItem.Text, dto.Text);
            Assert.AreEqual(listItem.Value, dto.Value);
        }
        public void can_selectItemBy_a_value()
        {
            ListControl webList = new DropDownList();
            ILookupList list = new WebLookupList(webList);

            webList.Items.Add(new ListItem("text1", "1111"));
            webList.Items.Add(new ListItem("text2", "2222"));
            list.selectItemBy("1111");
            Assert.AreEqual(0, webList.SelectedIndex);
            list.selectItemBy("2222");
            Assert.AreEqual(1, webList.SelectedIndex);
        }