public virtual void IsSelectedTest4() { List <object> items = new List <object> () { new object(), new object(), new object() }; IPoker box = CurrentControl; TestPanel.Children.Add((FrameworkElement)box); Enqueue(() => box.ApplyTemplate()); Enqueue(() => { items.ForEach(box.Items.Add); box.SelectedItem = items [2]; }); Enqueue(() => { Assert.AreEqual(2, box.SelectedIndex, "#1"); Assert.AreEqual(items [2], box.SelectedItem, "#2"); box.Items.Remove(box.Items [2]); }); Enqueue(() => { Assert.AreEqual(-1, box.SelectedIndex, "#3"); Assert.IsNull(box.SelectedItem, "#4"); }); EnqueueTestComplete(); }
public virtual void GetContainerForItemOverride10() { IPoker box = CurrentControl; TestPanel.Children.Add((FrameworkElement)box); Enqueue(() => box.ContainerItem = new ListBoxItem()); Enqueue(() => box.ApplyTemplate()); }
public virtual void GetInvalidContainerItemTest() { IPoker box = CurrentControl; TestPanel.Children.Add((FrameworkElement)box); Enqueue(() => box.ContainerItem = new Storyboard()); Enqueue(() => box.ApplyTemplate()); }
public virtual void ContainerItemTest2() { object item = new object(); IPoker c = CurrentControl; EnqueueWaitLoaded((FrameworkElement)c, "#loaded"); TestPanel.Children.Add((FrameworkElement)c); Enqueue(() => c.ApplyTemplate()); Enqueue(() => c.Items.Add(item)); }
public virtual void ContainerItemTest() { IPoker box = CurrentControl; var item1 = new ContentPresenter(); var item2 = new ListBoxItem(); var item3 = new ComboBoxItem(); CreateAsyncTest((FrameworkElement)box, () => box.ApplyTemplate(), () => { box.Items.Add(item1); box.Items.Add(item2); box.Items.Add(item3); }, () => { Assert.IsNull(item1.DataContext); Assert.IsNull(item2.DataContext); Assert.IsNull(item3.DataContext); } ); }