Exemple #1
0
 void AssertShowExpressionEditor(string expectedExpression)
 {
     View.UnboundExpressionEditorCreated += UnboundExpressionEditorHandler;
     try {
         UIAutomationActions.ClickButton(UnboundColumnsModule.showExpressionEditorButton);
         UpdateLayoutAndDoEvents();
         Assert.IsTrue(expressionEditorControl.IsVisible);
         Assert.AreEqual(expectedExpression, expressionEditorControl.Expression);
         UIAutomationActions.ClickButton(LayoutHelper.FindParentObject <DialogControl>(expressionEditorControl).CancelButton);
         UpdateLayoutAndDoEvents();
         Assert.IsFalse(expressionEditorControl.IsVisible);
         expressionEditorControl = null;
     } finally {
         View.UnboundExpressionEditorCreated -= UnboundExpressionEditorHandler;
     }
 }
Exemple #2
0
        void CreateCheckFilterControlDemoActions()
        {
            AddLoadModuleActions(typeof(FilterControl));
            AddSimpleAction(delegate() {
                Assert.IsTrue(View.AllowFilterEditor);
                CriteriaOperator filterCriteria = new BinaryOperator("OrderID", 10248, BinaryOperatorType.Equal);
                Assert.AreEqual(filterCriteria, FilterControlModule.filterEditor.FilterCriteria);
                Assert.AreEqual(filterCriteria, GridControl.FilterCriteria);
                Assert.AreEqual(false, FilterControlModule.showGroupCommandsIcon.IsChecked);
                Assert.AreEqual(false, FilterControlModule.showOperandTypeIcon.IsChecked);
                Assert.AreEqual(true, FilterControlModule.showToolTips.IsChecked);
                Assert.IsFalse(FilterControlModule.filterEditor.ShowGroupCommandsIcon);
                Assert.IsFalse(FilterControlModule.filterEditor.ShowOperandTypeIcon);
                Assert.IsTrue(FilterControlModule.filterEditor.ShowToolTips);
                EditorsActions.ToggleCheckEdit(FilterControlModule.showGroupCommandsIcon);
                UpdateLayoutAndDoEvents();
                Assert.IsTrue(FilterControlModule.filterEditor.ShowGroupCommandsIcon);
                EditorsActions.ToggleCheckEdit(FilterControlModule.showOperandTypeIcon);
                UpdateLayoutAndDoEvents();
                Assert.IsTrue(FilterControlModule.filterEditor.ShowOperandTypeIcon);
                EditorsActions.ToggleCheckEdit(FilterControlModule.showToolTips);
                UpdateLayoutAndDoEvents();
                Assert.IsFalse(FilterControlModule.filterEditor.ShowToolTips);

                filterCriteria = new BinaryOperator("OrderID", 10249L, BinaryOperatorType.Equal);
                FilterControlModule.filterEditor.FilterCriteria = filterCriteria;
                UpdateLayoutAndDoEvents();
                UIAutomationActions.ClickButton(FilterControlModule.ApplyFilterButton);
                Assert.AreEqual(filterCriteria, GridControl.FilterCriteria);
                filterCriteria             = new BinaryOperator("OrderID", 10250L, BinaryOperatorType.Equal);
                GridControl.FilterCriteria = filterCriteria;
                UpdateLayoutAndDoEvents();
                Assert.AreEqual(filterCriteria, FilterControlModule.filterEditor.FilterCriteria);

                View.FilterEditorCreated += new DevExpress.Xpf.Grid.FilterEditorEventHandler(View_FilterEditorCreated);
                View.ShowFilterEditor(null);
                UpdateLayoutAndDoEvents();
                Assert.IsNotNull(FilterEditorFromGrid);
                Assert.IsTrue(FilterEditorFromGrid.ShowGroupCommandsIcon);
                Assert.IsTrue(FilterEditorFromGrid.ShowOperandTypeIcon);
                Assert.IsFalse(FilterEditorFromGrid.ShowToolTips);

                DialogControl filterDialogControl = LayoutHelper.FindParentObject <DialogControl>(FilterEditorFromGrid);
                Assert.IsNotNull(filterDialogControl);
                UIAutomationActions.ClickButton(filterDialogControl.CancelButton);
            });
        }
Exemple #3
0
        void ToggleCheckEditAndPerformAction(CheckEdit checkEdit, string message, Action action, Action rollBack)
        {
            action();
            UpdateLayoutAndDoEvents();
            Assert.AreEqual(string.Empty, Events.textBox.Text);
            rollBack();
            UpdateLayoutAndDoEvents();

            checkEdit.IsChecked = true;
            action();
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(Events.textBox.Text.Contains(message));
            rollBack();

            UIAutomationActions.ClickButton(Events.clearButton);
            checkEdit.IsChecked = false;
            UpdateLayoutAndDoEvents();
        }
Exemple #4
0
        void SerializationTest()
        {
            ResetDockLayoutManager();

            LayoutGroup root = DockLayoutManager.LayoutRoot;

            Assert.AreEqual(3, root.Items.Count);
            Assert.IsTrue(root.Items[0] is LayoutGroup);
            Assert.IsTrue(root.Items[1] is LayoutPanel);
            Assert.IsTrue(root.Items[2] is LayoutGroup);

            LayoutPanel panel1 = ((LayoutGroup)root.Items[0]).Items[0] as LayoutPanel;
            LayoutPanel panel2 = ((LayoutGroup)root.Items[0]).Items[1] as LayoutPanel;
            LayoutPanel panel3 = ((LayoutGroup)root.Items[2]).Items[0] as LayoutPanel;
            LayoutPanel panel4 = ((LayoutGroup)root.Items[2]).Items[1] as LayoutPanel;

            Assert.IsTrue(SerializationModule.serializeButton.IsEnabled);
            Assert.IsFalse(SerializationModule.deserializeButton.IsEnabled);
            Assert.AreEqual(SerializationModule.layoutSampleName.Items.Count, 4);
            Assert.AreEqual(SerializationModule.layoutSampleName.SelectedIndex, 0);

            SerializationModule.layoutSampleName.SelectedIndex = 1;
            UIAutomationActions.ClickButton(SerializationModule.loadSampleLayoutButton);
            UpdateLayoutAndDoEvents();
            SerializationModule.layoutSampleName.SelectedIndex = 2;
            UIAutomationActions.ClickButton(SerializationModule.loadSampleLayoutButton);
            UpdateLayoutAndDoEvents();
            SerializationModule.layoutSampleName.SelectedIndex = 3;
            UIAutomationActions.ClickButton(SerializationModule.loadSampleLayoutButton);
            UpdateLayoutAndDoEvents();
            SerializationModule.layoutSampleName.SelectedIndex = 0;
            UIAutomationActions.ClickButton(SerializationModule.loadSampleLayoutButton);
            UpdateLayoutAndDoEvents();

            UIAutomationActions.ClickButton(SerializationModule.serializeButton);
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(SerializationModule.deserializeButton.IsEnabled);
            Assert.IsFalse(panel1.IsAutoHidden);
            DockLayoutManager.DockController.Hide(panel1);
            Assert.IsTrue(panel1.IsAutoHidden);
            UIAutomationActions.ClickButton(SerializationModule.deserializeButton);
            UpdateLayoutAndDoEvents();
            Assert.IsFalse(panel1.IsAutoHidden);
        }
Exemple #5
0
        void CreateCheckCopyPasteDemoActions()
        {
            AddLoadModuleActions(typeof(CopyPasteOperations));
            AddSimpleAction(delegate() {
                Assert.IsTrue(CopyPasteModule.firstGrid.ClipboardCopyMode != DevExpress.Xpf.Grid.ClipboardCopyMode.None);
                Assert.IsTrue(CopyPasteModule.secondGrid.ClipboardCopyMode != DevExpress.Xpf.Grid.ClipboardCopyMode.None);
                EditorsActions.ToggleCheckEdit(CopyPasteModule.allowCopyingtoClipboardCheckEdit);
                UpdateLayoutAndDoEvents();
                Assert.IsTrue(CopyPasteModule.firstGrid.ClipboardCopyMode == DevExpress.Xpf.Grid.ClipboardCopyMode.None);
                Assert.IsTrue(CopyPasteModule.secondGrid.ClipboardCopyMode == DevExpress.Xpf.Grid.ClipboardCopyMode.None);
                EditorsActions.ToggleCheckEdit(CopyPasteModule.allowCopyingtoClipboardCheckEdit);
                UpdateLayoutAndDoEvents();
                AssertGridsAndButtonState(FocusedGrid.None, false, false, false, false);

                Assert.AreEqual(10, CopyPasteModule.firstGrid.VisibleRowCount);
                Assert.AreEqual(0, CopyPasteModule.secondGrid.VisibleRowCount);

                Assert.AreEqual(0, CopyPasteModule.CopyPasteDemoTabControl.SelectedIndex);

                ClickOnGrid(CopyPasteModule.firstGrid);
                CopyPasteModule.firstGrid.SelectRange(1, 4);
                UpdateLayoutAndDoEvents();
                AssertGridsAndButtonState(FocusedGrid.First, true, true, false, true);

                Assert.AreEqual(0, CopyPasteModule.PasteRule.SelectedIndex);
                UIAutomationActions.ClickButton(CopyPasteModule.CopyButton);
                UpdateLayoutAndDoEvents();
                ClickOnGrid(CopyPasteModule.secondGrid);
                UpdateLayoutAndDoEvents();
                AssertGridsAndButtonState(FocusedGrid.Second, false, false, true, false);

                UIAutomationActions.ClickButton(CopyPasteModule.PasteButton);
            });
            AddEventAction(CopyPasteOperations.PasteCompetedEvent, () => DemoBaseTesting.CurrentDemoModule, null, null);
            AddSimpleAction(delegate() {
                Assert.AreEqual(5, CopyPasteModule.secondGrid.VisibleRowCount);
                ClickOnGrid(CopyPasteModule.firstGrid);
                UpdateLayoutAndDoEvents();
                AssertGridsAndButtonState(FocusedGrid.First, true, true, true, true);
                UIAutomationActions.ClickButton(CopyPasteModule.DeleteButton);
                UpdateLayoutAndDoEvents();
                Assert.AreEqual(5, CopyPasteModule.firstGrid.VisibleRowCount);

                CopyPasteModule.CopyPasteDemoTabControl.SelectedIndex = 1;
                UpdateLayoutAndDoEvents();
                CopyPasteModule.textEdit.Focus();
                UpdateLayoutAndDoEvents();
                AssertGridsAndButtonState(FocusedGrid.First, false, false, true, false);

                UIAutomationActions.ClickButton(CopyPasteModule.PasteButton);
                UpdateLayoutAndDoEvents();
                Assert.AreEqual("Id From Sent Hours Active Has Attachment", CopyPasteModule.textEdit.Text.Substring(0, 40));
                CopyPasteModule.textEdit.Select(0, 8);
                UpdateLayoutAndDoEvents();
                CopyPasteModule.textEdit.Focus();
                UpdateLayoutAndDoEvents();
                AssertGridsAndButtonState(FocusedGrid.First, true, true, true, true);
                UIAutomationActions.ClickButton(CopyPasteModule.CutButton);
                UpdateLayoutAndDoEvents();
                Assert.AreEqual("Sent Hours Active Has Attachment", CopyPasteModule.textEdit.Text.Substring(0, 32));
                CopyPasteModule.textEdit.Focus();
                UpdateLayoutAndDoEvents();
                CopyPasteModule.textEdit.CaretIndex = 0;
                UIAutomationActions.ClickButton(CopyPasteModule.PasteButton);
                UpdateLayoutAndDoEvents();
                Assert.AreEqual("Id From Sent Hours Active Has Attachment", CopyPasteModule.textEdit.Text.Substring(0, 40));
                CopyPasteModule.textEdit.SelectAll();
                UpdateLayoutAndDoEvents();
                CopyPasteModule.textEdit.Focus();
                UpdateLayoutAndDoEvents();
                UIAutomationActions.ClickButton(CopyPasteModule.CopyButton);
                UpdateLayoutAndDoEvents();
                CopyPasteModule.textEdit.Focus();
                UpdateLayoutAndDoEvents();
                UIAutomationActions.ClickButton(CopyPasteModule.DeleteButton);
                UpdateLayoutAndDoEvents();
                Assert.AreEqual("", CopyPasteModule.textEdit.Text);
                CopyPasteModule.textEdit.Focus();
                UpdateLayoutAndDoEvents();
                UIAutomationActions.ClickButton(CopyPasteModule.PasteButton);
                UpdateLayoutAndDoEvents();
                Assert.AreEqual("Id From Sent Hours Active Has Attachment", CopyPasteModule.textEdit.Text.Substring(0, 40));

                CopyPasteModule.CopyPasteDemoTabControl.SelectedIndex = 0;
                UpdateLayoutAndDoEvents();
                CopyPasteModule.secondGrid.UnselectAll();
                CopyPasteModule.secondGrid.SelectItem(2);
                UpdateLayoutAndDoEvents();
                ((GridDemo.CopyPasteOutlookData)((DevExpress.Xpf.Grid.GridViewBase)CopyPasteModule.secondGrid.View).Grid.SelectedItems[0]).From = "QWERTY";
                ClickOnGrid(CopyPasteModule.secondGrid);
                UpdateLayoutAndDoEvents();
                UIAutomationActions.ClickButton(CopyPasteModule.CutButton);
                UpdateLayoutAndDoEvents();
                Assert.AreEqual(4, CopyPasteModule.secondGrid.VisibleRowCount);

                CopyPasteModule.firstGrid.View.FocusedRowHandle = 2;
                ClickOnGrid(CopyPasteModule.firstGrid);
                UpdateLayoutAndDoEvents();
                UIAutomationActions.ClickButton(CopyPasteModule.PasteButton);
            });
            AddEventAction(CopyPasteOperations.PasteCompetedEvent, () => DemoBaseTesting.CurrentDemoModule, null, null);
            AddSimpleAction(delegate() {
                Assert.AreEqual(6, CopyPasteModule.firstGrid.VisibleRowCount);
                Assert.AreEqual("QWERTY", ((GridDemo.CopyPasteOutlookData)CopyPasteModule.firstGrid.GetRow(3)).From);

                CopyPasteModule.PasteRule.SelectedIndex = 1;
                UIAutomationActions.ClickButton(CopyPasteModule.PasteButton);
            });
            AddEventAction(CopyPasteOperations.PasteCompetedEvent, () => DemoBaseTesting.CurrentDemoModule, null, null);
            AddSimpleAction(delegate() {
                Assert.AreEqual(7, CopyPasteModule.firstGrid.VisibleRowCount);
                Assert.AreEqual("QWERTY", ((GridDemo.CopyPasteOutlookData)CopyPasteModule.firstGrid.GetRow(6)).From);
            });
        }
Exemple #6
0
        void AssertMuliSelection(DevExpress.Xpf.Grid.GridViewBase gridView)
        {
            AssertMultiSelectMode(gridView, true);

            MultiSelectionModule.selectionModeListBox.EditValue = DevExpress.Xpf.Grid.MultiSelectMode.None;
            UpdateLayoutAndDoEvents();
            AssertMultiSelectMode(gridView, false);
            Assert.IsFalse(MultiSelectionModule.ProductsMultiSelectionOptionsControl.IsEnabled);
            Assert.IsFalse(MultiSelectionModule.PriceMultiSelectionOptionsControl.IsEnabled);
            MultiSelectionModule.selectionModeListBox.EditValue = DevExpress.Xpf.Grid.MultiSelectMode.Row;
            UpdateLayoutAndDoEvents();
            AssertMultiSelectMode(gridView, true);
            Assert.IsTrue(MultiSelectionModule.ProductsMultiSelectionOptionsControl.IsEnabled);
            Assert.IsTrue(MultiSelectionModule.PriceMultiSelectionOptionsControl.IsEnabled);

            Assert.AreEqual(77, ((IEnumerable <Product>)((ComboBoxEdit)MultiSelectionModule.ProductsMultiSelectionOptionsControl.comboBoxControl).ItemsSource).Count());
            Assert.AreEqual(1, gridView.Grid.SelectedItems.Count);

            UIAutomationActions.ClickButton(MultiSelectionModule.ProductsMultiSelectionOptionsControl.SelectButton);
            UpdateLayoutAndDoEvents();
            Assert.AreEqual(39, gridView.Grid.SelectedItems.Count);
            Assert.AreEqual(39, GetListBoxEditCount(MultiSelectionModule.SelectionRowsListBox));

            UIAutomationActions.ClickButton(MultiSelectionModule.ProductsMultiSelectionOptionsControl.UnselectButton);
            UpdateLayoutAndDoEvents();
            Assert.AreEqual(1, gridView.Grid.SelectedItems.Count);
            Assert.AreEqual(1, GetListBoxEditCount(MultiSelectionModule.SelectionRowsListBox));

            UIAutomationActions.ClickButton(MultiSelectionModule.ProductsMultiSelectionOptionsControl.ReselectButton);
            UpdateLayoutAndDoEvents();
            Assert.AreEqual(38, gridView.Grid.SelectedItems.Count);
            Assert.AreEqual(38, GetListBoxEditCount(MultiSelectionModule.SelectionRowsListBox));

            gridView.Grid.UnselectAll();
            gridView.Grid.SelectRange(0, 3);

            Assert.AreEqual("Grand Total=${0:N}", gridView.VisibleColumns[4].TotalSummaries[0].Item.DisplayFormat);
            Assert.AreEqual(Convert.ToString(607.4, System.Globalization.CultureInfo.CurrentCulture), gridView.VisibleColumns[4].TotalSummaries[0].Value.ToString());
            GridControl.UnselectAll();

            int count = ((MultiSelectionModule.PriceMultiSelectionOptionsControl.comboBoxControl.ItemsSource) as System.Collections.Generic.List <Range>).Count;

            Assert.AreEqual(9, count);
            for (int i = 0; i < count; i++)
            {
                MultiSelectionModule.PriceMultiSelectionOptionsControl.comboBoxControl.SelectedIndex = i;
                UIAutomationActions.ClickButton(MultiSelectionModule.PriceMultiSelectionOptionsControl.SelectButton);
                UpdateLayoutAndDoEvents();
            }
            Assert.AreEqual(GridControl.VisibleRowCount, gridView.Grid.SelectedItems.Count);
            GridControl.UnselectAll();

            GridControl.GroupBy("OrderID");
            UpdateLayoutAndDoEvents();
            GridControl.SelectItem(0);
            GridControl.SelectItem(10);
            Assert.AreEqual("Grand Total=${0:N}", ((DevExpress.Xpf.Grid.GroupRowData)gridView.RootRowsContainer.Items[0]).GroupSummaryData[0].SummaryItem.DisplayFormat);
            Assert.AreEqual(168, Convert.ToInt32(((DevExpress.Xpf.Grid.GroupRowData)gridView.RootRowsContainer.Items[0]).GroupSummaryData[0].SummaryValue));
            Assert.AreEqual(336, Convert.ToInt32(((DevExpress.Xpf.Grid.GroupRowData)gridView.RootRowsContainer.Items[3]).GroupSummaryData[0].SummaryValue));
            Assert.AreEqual(504, Convert.ToInt32(gridView.VisibleColumns[4].TotalSummaries[0].Value));
            GridControl.ClearGrouping();
            GridControl.UnselectAll();
        }
Exemple #7
0
        void AssertGroupsAndItemsModuleView(Type viewType)
        {
            ArrayList images = ((ArrayList)GroupsAndItemsModule.FindResource("Images"));

            Assert.AreEqual(viewType, View.GetType());
            Assert.IsTrue(GroupsAndItemsModule.addGroupButton.IsEnabled);
            Assert.IsTrue(GroupsAndItemsModule.deleteLastGroupButton.IsEnabled);
            Assert.IsTrue(GroupsAndItemsModule.addNewItemButton.IsEnabled);
            Assert.IsFalse(GroupsAndItemsModule.deleteSelectedItemButton.IsEnabled);

            Assert.AreEqual(0, GroupsAndItemsModule.newGroupImageStyleList.SelectedIndex);
            Assert.AreEqual(0, GroupsAndItemsModule.newItemImageList.SelectedIndex);

            Assert.AreEqual(2, NavBarControl.Groups.Count);
            Assert.AreEqual("Group 1", NavBarControl.Groups[0].Header);
            Assert.AreEqual(1, NavBarControl.Groups[0].Items.Count);
            Assert.AreEqual("Item 1", ((NavBarItem)NavBarControl.Groups[0].Items[0]).Content);
            Assert.AreEqual("Group 2", NavBarControl.Groups[1].Header);
            Assert.AreEqual(1, NavBarControl.Groups[1].Items.Count);
            Assert.AreEqual("Item 1", ((NavBarItem)NavBarControl.Groups[1].Items[0]).Content);

            UIAutomationActions.ClickButton(GroupsAndItemsModule.addGroupButton);
            UpdateLayoutAndDoEvents();
            Assert.AreEqual(3, NavBarControl.Groups.Count);
            Assert.AreEqual("Group 3", NavBarControl.Groups[2].Header);
            Assert.AreEqual(0, NavBarControl.Groups[2].Items.Count);
            Assert.AreEqual(((Image)images[0]).Source, NavBarControl.Groups[2].ImageSource);
            Assert.AreEqual(16d, NavBarControl.Groups[2].ItemImageSettings.Height);
            Assert.AreEqual(16d, NavBarControl.Groups[2].ItemImageSettings.Width);

            GroupsAndItemsModule.newItemImageList.SelectedIndex       = 1;
            GroupsAndItemsModule.newGroupImageStyleList.SelectedIndex = 1;
            UpdateLayoutAndDoEvents();
            UIAutomationActions.ClickButton(GroupsAndItemsModule.addGroupButton);
            UpdateLayoutAndDoEvents();
            Assert.AreEqual(4, NavBarControl.Groups.Count);
            Assert.AreEqual("Group 4", NavBarControl.Groups[3].Header);
            Assert.AreEqual(0, NavBarControl.Groups[3].Items.Count);
            Assert.AreEqual(((Image)images[1]).Source, NavBarControl.Groups[3].ImageSource);
            Assert.AreEqual(32d, NavBarControl.Groups[3].ItemImageSettings.Height);
            Assert.AreEqual(32d, NavBarControl.Groups[3].ItemImageSettings.Width);
            Assert.AreEqual(System.Windows.HorizontalAlignment.Center, NavBarControl.Groups[3].ItemLayoutSettings.ImageHorizontalAlignment);
            Assert.AreEqual(System.Windows.HorizontalAlignment.Center, NavBarControl.Groups[3].ItemLayoutSettings.TextHorizontalAlignment);
            Assert.AreEqual(Dock.Top, NavBarControl.Groups[3].ItemLayoutSettings.ImageDocking);

            Assert.IsTrue(GroupsAndItemsModule.addGroupButton.IsEnabled);
            Assert.IsTrue(GroupsAndItemsModule.deleteLastGroupButton.IsEnabled);
            Assert.IsTrue(GroupsAndItemsModule.addNewItemButton.IsEnabled);
            Assert.IsFalse(GroupsAndItemsModule.deleteSelectedItemButton.IsEnabled);

            NavBarControl.ActiveGroup = NavBarControl.Groups[2];
            UpdateLayoutAndDoEvents();
            UIAutomationActions.ClickButton(GroupsAndItemsModule.addNewItemButton);
            UpdateLayoutAndDoEvents();
            Assert.AreEqual(1, NavBarControl.Groups[2].Items.Count);
            Assert.AreEqual("Item 1", ((NavBarItem)NavBarControl.Groups[2].Items[0]).Content);
            Assert.AreEqual(((Image)images[1]).Source, ((NavBarItem)NavBarControl.Groups[2].Items[0]).ImageSource);

            GroupsAndItemsModule.newItemImageList.SelectedIndex = 2;
            UpdateLayoutAndDoEvents();
            UIAutomationActions.ClickButton(GroupsAndItemsModule.addNewItemButton);
            UpdateLayoutAndDoEvents();
            Assert.AreEqual(2, NavBarControl.Groups[2].Items.Count);
            Assert.AreEqual("Item 2", ((NavBarItem)NavBarControl.Groups[2].Items[1]).Content);
            Assert.AreEqual(((Image)images[2]).Source, ((NavBarItem)NavBarControl.Groups[2].Items[1]).ImageSource);

            Assert.IsTrue(GroupsAndItemsModule.addGroupButton.IsEnabled);
            Assert.IsTrue(GroupsAndItemsModule.deleteLastGroupButton.IsEnabled);
            Assert.IsTrue(GroupsAndItemsModule.addNewItemButton.IsEnabled);
            Assert.IsFalse(GroupsAndItemsModule.deleteSelectedItemButton.IsEnabled);

            NavBarControl.ActiveGroup.SelectedItem = (NavBarItem)NavBarControl.Groups[2].Items[1];
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(GroupsAndItemsModule.addGroupButton.IsEnabled);
            Assert.IsTrue(GroupsAndItemsModule.deleteLastGroupButton.IsEnabled);
            Assert.IsTrue(GroupsAndItemsModule.addNewItemButton.IsEnabled);
            Assert.IsTrue(GroupsAndItemsModule.deleteSelectedItemButton.IsEnabled);

            UIAutomationActions.ClickButton(GroupsAndItemsModule.deleteSelectedItemButton);
            UpdateLayoutAndDoEvents();
            Assert.IsFalse(GroupsAndItemsModule.deleteSelectedItemButton.IsEnabled);
            Assert.AreEqual(1, NavBarControl.Groups[2].Items.Count);
            Assert.AreEqual("Item 1", ((NavBarItem)NavBarControl.Groups[2].Items[0]).Content);

            NavBarControl.ActiveGroup.SelectedItem = (NavBarItem)NavBarControl.Groups[2].Items[0];
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(GroupsAndItemsModule.deleteSelectedItemButton.IsEnabled);
            UIAutomationActions.ClickButton(GroupsAndItemsModule.deleteSelectedItemButton);
            UpdateLayoutAndDoEvents();
            Assert.AreEqual(0, NavBarControl.Groups[2].Items.Count);

            Assert.IsTrue(GroupsAndItemsModule.deleteLastGroupButton.IsEnabled);
            Assert.IsFalse(GroupsAndItemsModule.deleteSelectedItemButton.IsEnabled);
            UIAutomationActions.ClickButton(GroupsAndItemsModule.deleteLastGroupButton);
            UpdateLayoutAndDoEvents();
            Assert.AreEqual(3, NavBarControl.Groups.Count);
            Assert.AreEqual("Group 3", NavBarControl.Groups[2].Header);

            Assert.IsTrue(GroupsAndItemsModule.deleteLastGroupButton.IsEnabled);
            Assert.IsFalse(GroupsAndItemsModule.deleteSelectedItemButton.IsEnabled);
            UIAutomationActions.ClickButton(GroupsAndItemsModule.deleteLastGroupButton);
            UpdateLayoutAndDoEvents();
            Assert.AreEqual(2, NavBarControl.Groups.Count);
            Assert.AreEqual("Group 2", NavBarControl.Groups[1].Header);

            Assert.IsTrue(GroupsAndItemsModule.deleteLastGroupButton.IsEnabled);
            Assert.IsFalse(GroupsAndItemsModule.deleteSelectedItemButton.IsEnabled);
            UIAutomationActions.ClickButton(GroupsAndItemsModule.deleteLastGroupButton);
            UpdateLayoutAndDoEvents();
            Assert.AreEqual(1, NavBarControl.Groups.Count);
            Assert.AreEqual("Group 1", NavBarControl.Groups[0].Header);

            Assert.IsFalse(GroupsAndItemsModule.deleteLastGroupButton.IsEnabled);
            Assert.IsFalse(GroupsAndItemsModule.deleteSelectedItemButton.IsEnabled);
            NavBarControl.Groups.RemoveAt(0);

            GroupsAndItemsModule.newGroupImageStyleList.SelectedIndex = 0;
            GroupsAndItemsModule.newItemImageList.SelectedIndex       = 0;
            UpdateLayoutAndDoEvents();
            UIAutomationActions.ClickButton(GroupsAndItemsModule.addGroupButton);
            UpdateLayoutAndDoEvents();
            NavBarControl.ActiveGroup = NavBarControl.Groups[0];
            UpdateLayoutAndDoEvents();
            UIAutomationActions.ClickButton(GroupsAndItemsModule.addNewItemButton);
            UpdateLayoutAndDoEvents();
            UIAutomationActions.ClickButton(GroupsAndItemsModule.addGroupButton);
            UpdateLayoutAndDoEvents();
            NavBarControl.ActiveGroup = NavBarControl.Groups[1];
            UpdateLayoutAndDoEvents();
            UIAutomationActions.ClickButton(GroupsAndItemsModule.addNewItemButton);
            UpdateLayoutAndDoEvents();
        }