示例#1
0
        public void IGridProvider_Methods()
        {
            Calendar                  calendar     = CreateConcreteFrameworkElement() as Calendar;
            AutomationPeer            peer         = FrameworkElementAutomationPeer.CreatePeerForElement(calendar);
            IGridProvider             gridProvider = null;
            IRawElementProviderSimple cell         = null;
            AutomationPeer            cellPeer     = null;

            CreateAsyncTest(calendar,
                            () => {
                Assert.IsNotNull(peer, "#0");
                gridProvider = peer.GetPattern(PatternInterface.Grid) as IGridProvider;
                Assert.IsNotNull(gridProvider, "#1");

                // IGridProvider.RowCount
                calendar.DisplayMode = CalendarMode.Month;
                Assert.AreEqual(6, gridProvider.RowCount, "RowCount #0");                  // First row displays day titles
                calendar.DisplayMode = CalendarMode.Decade;
                Assert.AreEqual(3, gridProvider.RowCount, "RowCount #1");
                calendar.DisplayMode = CalendarMode.Year;
                Assert.AreEqual(3, gridProvider.RowCount, "RowCount #2");
                // IGridProvider.ColumnCount
                calendar.DisplayMode = CalendarMode.Month;
                Assert.AreEqual(7, gridProvider.ColumnCount, "ColumnCount #0");
                calendar.DisplayMode = CalendarMode.Decade;
                Assert.AreEqual(4, gridProvider.ColumnCount, "ColumnCount #1");
                calendar.DisplayMode = CalendarMode.Year;
                Assert.AreEqual(4, gridProvider.ColumnCount, "ColumnCount #2");
                // IGridProvider.GetItem
                calendar.DisplayMode = CalendarMode.Month;

                cell = gridProvider.GetItem(0, 3);
                Assert.IsNotNull(cell, "GetItem #0");
                cellPeer = new PeerFromProvider().GetPeerFromProvider(cell);
                Assert.AreEqual(typeof(CalendarDayButton).Name, cellPeer.GetClassName(), "GetItem.ClassName #0");

                calendar.DisplayMode = CalendarMode.Year;

                cell = gridProvider.GetItem(2, 3);
                Assert.IsNotNull(cell, "GetItem #1");
                cellPeer = new PeerFromProvider().GetPeerFromProvider(cell);
                Assert.AreEqual(typeof(CalendarButton).Name, cellPeer.GetClassName(), "GetItem.ClassName #1");

                calendar.DisplayMode = CalendarMode.Decade;

                cell = gridProvider.GetItem(2, 3);
                Assert.IsNotNull(cell, "GetItem #2");
                cellPeer = new PeerFromProvider().GetPeerFromProvider(cell);
                Assert.AreEqual(typeof(CalendarButton).Name, cellPeer.GetClassName(), "GetItem.ClassName #2");

                cell = gridProvider.GetItem(10, 10);
                Assert.IsNull(cell, "GetItem #3");
            });
        }
示例#2
0
        public void ISelectionProvider_Methods()
        {
            Calendar           calendar          = CreateConcreteFrameworkElement() as Calendar;
            AutomationPeer     peer              = FrameworkElementAutomationPeer.CreatePeerForElement(calendar);
            ISelectionProvider selectionProvider = null;

            CreateAsyncTest(calendar,
                            () => {
                Assert.IsNotNull(peer, "#0");
                selectionProvider = peer.GetPattern(PatternInterface.Selection) as ISelectionProvider;
                Assert.IsNotNull(selectionProvider, "#1");
                // ISelectionProvider.IsSelectionRequired
                calendar.SelectionMode = CalendarSelectionMode.None;
                Assert.IsFalse(selectionProvider.IsSelectionRequired, "IsSelectionRequired #0");
                calendar.SelectionMode = CalendarSelectionMode.SingleDate;
                Assert.IsFalse(selectionProvider.IsSelectionRequired, "IsSelectionRequired #1");
                calendar.SelectionMode = CalendarSelectionMode.SingleRange;
                Assert.IsFalse(selectionProvider.IsSelectionRequired, "IsSelectionRequired #2");
                calendar.SelectionMode = CalendarSelectionMode.MultipleRange;
                Assert.IsFalse(selectionProvider.IsSelectionRequired, "IsSelectionRequired #3");
                // ISelectionProvider.CanSelectMultiple
                calendar.SelectionMode = CalendarSelectionMode.None;
                Assert.IsFalse(selectionProvider.CanSelectMultiple, "CanSelectMultiple #0");
                calendar.SelectionMode = CalendarSelectionMode.SingleDate;
                Assert.IsFalse(selectionProvider.CanSelectMultiple, "CanSelectMultiple #1");
                calendar.SelectionMode = CalendarSelectionMode.SingleRange;
                Assert.IsTrue(selectionProvider.CanSelectMultiple, "CanSelectMultiple #2");
                calendar.SelectionMode = CalendarSelectionMode.MultipleRange;
                Assert.IsTrue(selectionProvider.CanSelectMultiple, "CanSelectMultiple #3");
                // ISelectionProvider.GetSelection
                Assert.IsNull(calendar.SelectedDate);
                Assert.IsTrue(selectionProvider.CanSelectMultiple, "GetSelection #0");
                calendar.DisplayMode = CalendarMode.Year;
                calendar.SelectedDates.AddRange(new DateTime(2000, 2, 10), new DateTime(2000, 3, 30));

                IRawElementProviderSimple[] selection = selectionProvider.GetSelection();
                Assert.IsNull(selection, "GetSelection #1");

                calendar.DisplayMode = CalendarMode.Month;

                selection = selectionProvider.GetSelection();
                Assert.IsNotNull(selection, "GetSelection #4");
                Assert.AreEqual(selection.Length, 31, "GetSelection #5");
                AutomationPeer cellPeer = new PeerFromProvider().GetPeerFromProvider(selection [0]);
                Assert.AreEqual(cellPeer.GetClassName(), typeof(CalendarDayButton).Name, "GetSelection #6");
            });
        }
示例#3
0
        public virtual void ISelectionProvider_Events()
        {
            if (!EventsManager.Instance.AutomationSingletonExists)
            {
                EnqueueTestComplete();
                return;
            }

            Selector selector = CreateConcreteFrameworkElement() as Selector;

            selector.Width  = 300;
            selector.Height = 400;

            selector.Items.Add(new TextBlock()
            {
                Text = "Item0"
            });
            selector.Items.Add(new TextBlock()
            {
                Text = "Item1"
            });

            AutomationPeer peer      = null;
            AutomationPeer childPeer = null;

            IRawElementProviderSimple[]  selection         = null;
            AutomationPropertyEventTuple propertyTuple     = null;
            ISelectionProvider           selectionProvider = null;

            CreateAsyncTest(selector,
                            () => {
                peer = FrameworkElementAutomationPeer.CreatePeerForElement(selector);

                selectionProvider = peer.GetPattern(PatternInterface.Selection) as ISelectionProvider;
                Assert.IsNotNull(selectionProvider, "Selection Provider");

                Assert.IsFalse(selectionProvider.CanSelectMultiple, "CanSelectMultiple #0");
                Assert.IsFalse(selectionProvider.IsSelectionRequired, "IsSelectionRequired #0");

                selection = selectionProvider.GetSelection();
                Assert.IsNull(selection, "GetSelection #0");
            },
                            () => {
                EventsManager.Instance.Reset();
                selector.SelectedIndex = 1;
            },
                            () => {
                selection = selectionProvider.GetSelection();
                Assert.IsNotNull(selection, "GetSelection #1");
                Assert.AreEqual(1, selection.Length, "GetSelection #2");

                propertyTuple = EventsManager.Instance.GetAutomationEventFrom(peer, SelectionPatternIdentifiers.SelectionProperty);
                Assert.IsNotNull(propertyTuple, "GetAutomationPropertyEventFrom #0");
                Assert.IsNull(propertyTuple.OldValue, "GetPropertyAutomationEventFrom.OldValue #0");
                Assert.IsNotNull(propertyTuple.NewValue, "GetPropertyAutomationEventFrom.NewValue #0");

                childPeer = new PeerFromProvider().GetPeerFromProvider(selection [0]);
            },
                            () => {
                EventsManager.Instance.Reset();
                selector.Items.Add(new TextBlock()
                {
                    Text = "Item1"
                });
                selector.SelectedIndex = 0;
            },
                            () => {
                selection = selectionProvider.GetSelection();
                Assert.IsNotNull(selection, "GetSelection #3");
                Assert.AreEqual(1, selection.Length, "GetSelection #4");

                propertyTuple = EventsManager.Instance.GetAutomationEventFrom(peer, SelectionPatternIdentifiers.SelectionProperty);
                Assert.IsNotNull(propertyTuple, "GetAutomationPropertyEventFrom #1");
                Assert.IsNotNull(propertyTuple.OldValue, "GetPropertyAutomationEventFrom.OldValue #1");
                Assert.IsNotNull(propertyTuple.NewValue, "GetPropertyAutomationEventFrom.NewValue #1");

                Assert.AreNotEqual(selection [0], childPeer, "GetSelection #5");
            },
                            () => {
                EventsManager.Instance.Reset();
                selector.SelectedIndex = -1;
            },
                            () => {
                selection = selectionProvider.GetSelection();
                Assert.IsNull(selection, "GetSelection #6");

                propertyTuple = EventsManager.Instance.GetAutomationEventFrom(peer, SelectionPatternIdentifiers.SelectionProperty);
                Assert.IsNotNull(propertyTuple, "GetAutomationPropertyEventFrom #2");
                Assert.IsNotNull(propertyTuple.OldValue, "GetPropertyAutomationEventFrom.OldValue #2");
                Assert.IsNull(propertyTuple.NewValue, "GetPropertyAutomationEventFrom.NewValue #2");
            });
        }
示例#4
0
		public void ISelectionProvider_Methods ()
		{
			Calendar calendar = CreateConcreteFrameworkElement () as Calendar;
			AutomationPeer peer = FrameworkElementAutomationPeer.CreatePeerForElement (calendar);
			ISelectionProvider selectionProvider = null;

			CreateAsyncTest (calendar,
			() => {
				Assert.IsNotNull (peer, "#0");
				selectionProvider = peer.GetPattern (PatternInterface.Selection) as ISelectionProvider;
				Assert.IsNotNull (selectionProvider, "#1");
				// ISelectionProvider.IsSelectionRequired
				calendar.SelectionMode = CalendarSelectionMode.None;
				Assert.IsFalse (selectionProvider.IsSelectionRequired, "IsSelectionRequired #0");
				calendar.SelectionMode = CalendarSelectionMode.SingleDate;
				Assert.IsFalse (selectionProvider.IsSelectionRequired, "IsSelectionRequired #1");
				calendar.SelectionMode = CalendarSelectionMode.SingleRange;
				Assert.IsFalse (selectionProvider.IsSelectionRequired, "IsSelectionRequired #2");
				calendar.SelectionMode = CalendarSelectionMode.MultipleRange;
				Assert.IsFalse (selectionProvider.IsSelectionRequired, "IsSelectionRequired #3");
				// ISelectionProvider.CanSelectMultiple
				calendar.SelectionMode = CalendarSelectionMode.None;
				Assert.IsFalse (selectionProvider.CanSelectMultiple, "CanSelectMultiple #0");
				calendar.SelectionMode = CalendarSelectionMode.SingleDate;
				Assert.IsFalse (selectionProvider.CanSelectMultiple, "CanSelectMultiple #1");
				calendar.SelectionMode = CalendarSelectionMode.SingleRange;
				Assert.IsTrue (selectionProvider.CanSelectMultiple, "CanSelectMultiple #2");
				calendar.SelectionMode = CalendarSelectionMode.MultipleRange;
				Assert.IsTrue (selectionProvider.CanSelectMultiple, "CanSelectMultiple #3");
				// ISelectionProvider.GetSelection
				Assert.IsNull (calendar.SelectedDate);
				Assert.IsTrue (selectionProvider.CanSelectMultiple, "GetSelection #0");
				calendar.DisplayMode = CalendarMode.Year;
				calendar.SelectedDates.AddRange (new DateTime(2000, 2, 10), new DateTime (2000, 3, 30));

				IRawElementProviderSimple[] selection = selectionProvider.GetSelection ();
				Assert.IsNull (selection, "GetSelection #1");

				calendar.DisplayMode = CalendarMode.Month;

				selection = selectionProvider.GetSelection ();
				Assert.IsNotNull (selection, "GetSelection #4");
				Assert.AreEqual (selection.Length, 31, "GetSelection #5");
				AutomationPeer cellPeer = new PeerFromProvider ().GetPeerFromProvider (selection [0]);
				Assert.AreEqual (cellPeer.GetClassName (), typeof(CalendarDayButton).Name, "GetSelection #6");
			});
		}
示例#5
0
		public void IGridProvider_Methods ()
		{
			Calendar calendar = CreateConcreteFrameworkElement () as Calendar;
			AutomationPeer peer = FrameworkElementAutomationPeer.CreatePeerForElement (calendar);
			IGridProvider gridProvider = null;
			IRawElementProviderSimple cell = null;
			AutomationPeer cellPeer = null;

			CreateAsyncTest (calendar,
			() => {
				Assert.IsNotNull (peer, "#0");
				gridProvider = peer.GetPattern (PatternInterface.Grid) as IGridProvider;
				Assert.IsNotNull (gridProvider, "#1");

				// IGridProvider.RowCount
				calendar.DisplayMode = CalendarMode.Month;
				Assert.AreEqual (6, gridProvider.RowCount, "RowCount #0"); // First row displays day titles
				calendar.DisplayMode = CalendarMode.Decade;
				Assert.AreEqual (3, gridProvider.RowCount, "RowCount #1");
				calendar.DisplayMode = CalendarMode.Year;
				Assert.AreEqual (3, gridProvider.RowCount, "RowCount #2");
				// IGridProvider.ColumnCount
				calendar.DisplayMode = CalendarMode.Month;
				Assert.AreEqual (7, gridProvider.ColumnCount, "ColumnCount #0");
				calendar.DisplayMode = CalendarMode.Decade;
				Assert.AreEqual (4, gridProvider.ColumnCount, "ColumnCount #1");
				calendar.DisplayMode = CalendarMode.Year;
				Assert.AreEqual (4, gridProvider.ColumnCount, "ColumnCount #2");
				// IGridProvider.GetItem
				calendar.DisplayMode = CalendarMode.Month;
				
				cell = gridProvider.GetItem (0, 3);
				Assert.IsNotNull (cell, "GetItem #0");
				cellPeer = new PeerFromProvider ().GetPeerFromProvider (cell);
				Assert.AreEqual (typeof (CalendarDayButton).Name, cellPeer.GetClassName (), "GetItem.ClassName #0");

				calendar.DisplayMode = CalendarMode.Year;

				cell = gridProvider.GetItem (2, 3);
				Assert.IsNotNull (cell, "GetItem #1");
				cellPeer = new PeerFromProvider ().GetPeerFromProvider (cell);
				Assert.AreEqual (typeof (CalendarButton).Name, cellPeer.GetClassName (), "GetItem.ClassName #1");

				calendar.DisplayMode = CalendarMode.Decade;

				cell = gridProvider.GetItem (2, 3);
				Assert.IsNotNull (cell, "GetItem #2");
				cellPeer = new PeerFromProvider ().GetPeerFromProvider (cell);
				Assert.AreEqual (typeof (CalendarButton).Name, cellPeer.GetClassName (), "GetItem.ClassName #2");

				cell = gridProvider.GetItem (10, 10);
				Assert.IsNull (cell, "GetItem #3");
			});
		}
示例#6
0
		public override void ISelectionProvider_Events ()
		{
			if (!EventsManager.Instance.AutomationSingletonExists) {
				EnqueueTestComplete ();
				return;
			}

			bool expanded = false;
			bool concreteLoaded = false;
			ComboBox combobox = CreateConcreteFrameworkElement () as ComboBox;
			combobox.Width = 300;
			combobox.Height = 400;
			combobox.Loaded += (o, e) => concreteLoaded = true;
			combobox.DropDownOpened += (o, e) => expanded = true;

			combobox.Items.Add (new TextBlock () { Text = "Item0" });
			combobox.Items.Add (new TextBlock () { Text = "Item1" });

			AutomationPeer peer = null;
			AutomationPeer childPeer = null;
			IRawElementProviderSimple[] selection = null;
			AutomationPropertyEventTuple propertyTuple = null;
			ISelectionProvider selectionProvider = null;

			TestPanel.Children.Add (combobox);

			EnqueueConditional (() => concreteLoaded, "ConcreteLoaded #0");
			Enqueue (() => combobox.ApplyTemplate ());
			Enqueue (() => combobox.IsDropDownOpen = true);
			EnqueueConditional (() => expanded, "Expanded #0");
			Enqueue (() => combobox.IsDropDownOpen = false);
			Enqueue (() => {
				peer = FrameworkElementAutomationPeer.CreatePeerForElement (combobox);

				selectionProvider = peer.GetPattern (PatternInterface.Selection) as ISelectionProvider;
				Assert.IsNotNull (selectionProvider, "Selection Provider");

				Assert.IsFalse (selectionProvider.CanSelectMultiple, "CanSelectMultiple #0");
				Assert.IsFalse (selectionProvider.IsSelectionRequired, "IsSelectionRequired #0");

				selection = selectionProvider.GetSelection ();
				Assert.IsNull (selection, "GetSelection #0");
			});
			Enqueue (() => { 
				EventsManager.Instance.Reset ();
				combobox.SelectedIndex = 1; 
			});
			Enqueue (() => {
				selection = selectionProvider.GetSelection ();
				Assert.IsNotNull (selection, "GetSelection #1");
				Assert.AreEqual (1, selection.Length, "GetSelection #2");

				propertyTuple = EventsManager.Instance.GetAutomationEventFrom (peer, SelectionPatternIdentifiers.SelectionProperty);
				Assert.IsNotNull (propertyTuple, "GetAutomationPropertyEventFrom #0");
				Assert.IsNull (propertyTuple.OldValue, "GetPropertyAutomationEventFrom.OldValue #0");
				Assert.IsNotNull (propertyTuple.NewValue, "GetPropertyAutomationEventFrom.NewValue #0");
				
				childPeer = new PeerFromProvider ().GetPeerFromProvider (selection [0]);
			});
			Enqueue (() => {
				EventsManager.Instance.Reset ();
				combobox.Items.Add (new TextBlock () { Text = "Item1" });
				combobox.SelectedIndex = 0;
			});
			Enqueue (() => {
				selection = selectionProvider.GetSelection ();
				Assert.IsNotNull (selection, "GetSelection #3");
				Assert.AreEqual (1, selection.Length, "GetSelection #4");

				propertyTuple = EventsManager.Instance.GetAutomationEventFrom (peer, SelectionPatternIdentifiers.SelectionProperty);
				Assert.IsNotNull (propertyTuple, "GetAutomationPropertyEventFrom #1");
				Assert.IsNotNull (propertyTuple.OldValue, "GetPropertyAutomationEventFrom.OldValue #1");
				Assert.IsNotNull (propertyTuple.NewValue, "GetPropertyAutomationEventFrom.NewValue #1");

				Assert.AreNotEqual (selection [0], childPeer, "GetSelection #5");
			});
			Enqueue (() => { 
				EventsManager.Instance.Reset ();
				combobox.SelectedIndex = -1;
			});
			Enqueue (() => {
				selection = selectionProvider.GetSelection ();
				Assert.IsNull (selection, "GetSelection #6");
				
				propertyTuple = EventsManager.Instance.GetAutomationEventFrom (peer, SelectionPatternIdentifiers.SelectionProperty);
				Assert.IsNotNull (propertyTuple, "GetAutomationPropertyEventFrom #2");
				Assert.IsNotNull (propertyTuple.OldValue, "GetPropertyAutomationEventFrom.OldValue #2");
				Assert.IsNull (propertyTuple.NewValue, "GetPropertyAutomationEventFrom.NewValue #2");
			});
			EnqueueTestComplete ();
		}
示例#7
0
		public virtual void ISelectionProvider_Events ()
		{
			if (!EventsManager.Instance.AutomationSingletonExists) {
				EnqueueTestComplete ();
				return;
			}

			Selector selector = CreateConcreteFrameworkElement () as Selector;
			selector.Width = 300;
			selector.Height = 400;

			selector.Items.Add (new TextBlock () { Text = "Item0" });
			selector.Items.Add (new TextBlock () { Text = "Item1" });

			AutomationPeer peer = null;
			AutomationPeer childPeer = null;
			IRawElementProviderSimple[] selection = null;
			AutomationPropertyEventTuple propertyTuple = null;
			ISelectionProvider selectionProvider = null;

			CreateAsyncTest (selector,
			() => {
				peer = FrameworkElementAutomationPeer.CreatePeerForElement (selector);

				selectionProvider = peer.GetPattern (PatternInterface.Selection) as ISelectionProvider;
				Assert.IsNotNull (selectionProvider, "Selection Provider");

				Assert.IsFalse (selectionProvider.CanSelectMultiple, "CanSelectMultiple #0");
				Assert.IsFalse (selectionProvider.IsSelectionRequired, "IsSelectionRequired #0");

				selection = selectionProvider.GetSelection ();
				Assert.IsNull (selection, "GetSelection #0");
			},
			() => { 
				EventsManager.Instance.Reset ();
				selector.SelectedIndex = 1; 
			},
			() => {
				selection = selectionProvider.GetSelection ();
				Assert.IsNotNull (selection, "GetSelection #1");
				Assert.AreEqual (1, selection.Length, "GetSelection #2");

				propertyTuple = EventsManager.Instance.GetAutomationEventFrom (peer, SelectionPatternIdentifiers.SelectionProperty);
				Assert.IsNotNull (propertyTuple, "GetAutomationPropertyEventFrom #0");
				Assert.IsNull (propertyTuple.OldValue, "GetPropertyAutomationEventFrom.OldValue #0");
				Assert.IsNotNull (propertyTuple.NewValue, "GetPropertyAutomationEventFrom.NewValue #0");
				
				childPeer = new PeerFromProvider ().GetPeerFromProvider (selection [0]);
			},
			() => {
				EventsManager.Instance.Reset ();
				selector.Items.Add (new TextBlock () { Text = "Item1" });
				selector.SelectedIndex = 0;
			},
			() => {
				selection = selectionProvider.GetSelection ();
				Assert.IsNotNull (selection, "GetSelection #3");
				Assert.AreEqual (1, selection.Length, "GetSelection #4");

				propertyTuple = EventsManager.Instance.GetAutomationEventFrom (peer, SelectionPatternIdentifiers.SelectionProperty);
				Assert.IsNotNull (propertyTuple, "GetAutomationPropertyEventFrom #1");
				Assert.IsNotNull (propertyTuple.OldValue, "GetPropertyAutomationEventFrom.OldValue #1");
				Assert.IsNotNull (propertyTuple.NewValue, "GetPropertyAutomationEventFrom.NewValue #1");

				Assert.AreNotEqual (selection [0],childPeer,"GetSelection #5");
			},
			() => { 
				EventsManager.Instance.Reset ();
				selector.SelectedIndex = -1;
			},
			() => {
				selection = selectionProvider.GetSelection ();
				Assert.IsNull (selection, "GetSelection #6");
				
				propertyTuple = EventsManager.Instance.GetAutomationEventFrom (peer, SelectionPatternIdentifiers.SelectionProperty);
				Assert.IsNotNull (propertyTuple, "GetAutomationPropertyEventFrom #2");
				Assert.IsNotNull (propertyTuple.OldValue, "GetPropertyAutomationEventFrom.OldValue #2");
				Assert.IsNull (propertyTuple.NewValue, "GetPropertyAutomationEventFrom.NewValue #2");
			});
		}
示例#8
0
        public override void ISelectionProvider_Events()
        {
            if (!EventsManager.Instance.AutomationSingletonExists)
            {
                EnqueueTestComplete();
                return;
            }

            bool     expanded       = false;
            bool     concreteLoaded = false;
            ComboBox combobox       = CreateConcreteFrameworkElement() as ComboBox;

            combobox.Width           = 300;
            combobox.Height          = 400;
            combobox.Loaded         += (o, e) => concreteLoaded = true;
            combobox.DropDownOpened += (o, e) => expanded = true;

            combobox.Items.Add(new TextBlock()
            {
                Text = "Item0"
            });
            combobox.Items.Add(new TextBlock()
            {
                Text = "Item1"
            });

            AutomationPeer peer      = null;
            AutomationPeer childPeer = null;

            IRawElementProviderSimple[]  selection         = null;
            AutomationPropertyEventTuple propertyTuple     = null;
            ISelectionProvider           selectionProvider = null;

            TestPanel.Children.Add(combobox);

            EnqueueConditional(() => concreteLoaded, "ConcreteLoaded #0");
            Enqueue(() => combobox.ApplyTemplate());
            Enqueue(() => combobox.IsDropDownOpen = true);
            EnqueueConditional(() => expanded, "Expanded #0");
            Enqueue(() => combobox.IsDropDownOpen = false);
            Enqueue(() => {
                peer = FrameworkElementAutomationPeer.CreatePeerForElement(combobox);

                selectionProvider = peer.GetPattern(PatternInterface.Selection) as ISelectionProvider;
                Assert.IsNotNull(selectionProvider, "Selection Provider");

                Assert.IsFalse(selectionProvider.CanSelectMultiple, "CanSelectMultiple #0");
                Assert.IsFalse(selectionProvider.IsSelectionRequired, "IsSelectionRequired #0");

                selection = selectionProvider.GetSelection();
                Assert.IsNull(selection, "GetSelection #0");
            });
            Enqueue(() => {
                EventsManager.Instance.Reset();
                combobox.SelectedIndex = 1;
            });
            Enqueue(() => {
                selection = selectionProvider.GetSelection();
                Assert.IsNotNull(selection, "GetSelection #1");
                Assert.AreEqual(1, selection.Length, "GetSelection #2");

                propertyTuple = EventsManager.Instance.GetAutomationEventFrom(peer, SelectionPatternIdentifiers.SelectionProperty);
                Assert.IsNotNull(propertyTuple, "GetAutomationPropertyEventFrom #0");
                Assert.IsNull(propertyTuple.OldValue, "GetPropertyAutomationEventFrom.OldValue #0");
                Assert.IsNotNull(propertyTuple.NewValue, "GetPropertyAutomationEventFrom.NewValue #0");

                childPeer = new PeerFromProvider().GetPeerFromProvider(selection [0]);
            });
            Enqueue(() => {
                EventsManager.Instance.Reset();
                combobox.Items.Add(new TextBlock()
                {
                    Text = "Item1"
                });
                combobox.SelectedIndex = 0;
            });
            Enqueue(() => {
                selection = selectionProvider.GetSelection();
                Assert.IsNotNull(selection, "GetSelection #3");
                Assert.AreEqual(1, selection.Length, "GetSelection #4");

                propertyTuple = EventsManager.Instance.GetAutomationEventFrom(peer, SelectionPatternIdentifiers.SelectionProperty);
                Assert.IsNotNull(propertyTuple, "GetAutomationPropertyEventFrom #1");
                Assert.IsNotNull(propertyTuple.OldValue, "GetPropertyAutomationEventFrom.OldValue #1");
                Assert.IsNotNull(propertyTuple.NewValue, "GetPropertyAutomationEventFrom.NewValue #1");

                Assert.AreNotEqual(selection [0], childPeer, "GetSelection #5");
            });
            Enqueue(() => {
                EventsManager.Instance.Reset();
                combobox.SelectedIndex = -1;
            });
            Enqueue(() => {
                selection = selectionProvider.GetSelection();
                Assert.IsNull(selection, "GetSelection #6");

                propertyTuple = EventsManager.Instance.GetAutomationEventFrom(peer, SelectionPatternIdentifiers.SelectionProperty);
                Assert.IsNotNull(propertyTuple, "GetAutomationPropertyEventFrom #2");
                Assert.IsNotNull(propertyTuple.OldValue, "GetPropertyAutomationEventFrom.OldValue #2");
                Assert.IsNull(propertyTuple.NewValue, "GetPropertyAutomationEventFrom.NewValue #2");
            });
            EnqueueTestComplete();
        }