public void can_update()
        {
            SimpleLookupDTO selectedItem = new SimpleLookupDTO("0", "blah blah blah");
            HttpContext context = (new MockHttpContext(false)).Context;

            Expect.Once.On(view).GetProperty("PlaylistControl").Will(Return.Value(lookupList));
            Expect.Once.On(lookupList).GetProperty("SelectedItem").Will(Return.Value(selectedItem));
            Expect.Once.On(view).GetProperty("SessionState").Will(Return.Value(context.Session));

            presenter.update();
        }
        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_bindTo_LookupList()
        {
            IList<ILookupDTO> dtoList = new List<ILookupDTO>();
            ILookupList mockLookupList = mockery.NewMock<ILookupList>();

            Expect.Once.On(mockLookupList).Method("clear");

            for(int i = 0; i < 10; i++) {
                SimpleLookupDTO dto = new SimpleLookupDTO(i.ToString(), i.ToString());
                dtoList.Add(dto);
                Expect.Once.On(mockLookupList).Method("add").With(dto);
            }

            LookupCollection collection = new LookupCollection(dtoList);
            collection.bindTo(mockLookupList);
        }
        public void can_updateForRedirect()
        {
            SimpleLookupDTO selectedItem = new SimpleLookupDTO("1", "blah blah blah");

            Expect.Once.On(view).GetProperty("PlaylistControl").Will(Return.Value(lookupList));
            Expect.Once.On(lookupList).GetProperty("SelectedItem").Will(Return.Value(selectedItem));
            Expect.Once.On(view).SetProperty("RedirectQueryValue").To(selectedItem.Value);

            presenter.updateForRedirect();
        }
        public void wont_redirect_without_valid_activePlaylistID()
        {
            SimpleLookupDTO selectedItem = new SimpleLookupDTO("0", "blah blah blah");

            Expect.Once.On(view).GetProperty("PlaylistControl").Will(Return.Value(lookupList));
            Expect.Once.On(lookupList).GetProperty("SelectedItem").Will(Return.Value(selectedItem));
            Expect.Never.On(view).SetProperty("RedirectQueryValue").To(selectedItem.Value);

            presenter.updateForRedirect();
        }