private void ShowTopLevel(Control control, object[] propertyObjects, bool modal, Action shownAction) { ThrowIfPropertyObjectsContainsActionDueToLikelyMisuse(propertyObjects); GuiTestHelper.Initialize(); this.shownAction = shownAction; if (control is Window) { ShowTopLevelControl(control, modal); } else { ShowControlInTestForm(control, modal, propertyObjects); } // clear all controls shown as non-modal after modal control closes if (!modal) { throw new NotImplementedException(); } else { WindowsFormsTestHelper.CloseAll(); // just in case, since we have mixed WPF / WF app Close(); if (window != null) { window.Closed += delegate { Console.WriteLine("Closed"); }; window.Close(); window.Close(); while (window.IsVisible) { System.Windows.Forms.Application.DoEvents(); } window = null; } } }
public void TestInsertRecordOnGridBoundToAFunctionBindingList() { //setup a function to bind to IFunction function = new Function(); IVariable argument = new Variable<int>(); IVariable component = new Variable<int>(); function.Arguments.Add(argument); function.Components.Add(component); function[0] = 1; function[1] = 1; function[2] = 1; //setup a grid with a menu GridControl gridControl = new GridControl(); gridControl.DataSource = new FunctionBindingList(function) { SynchronizeInvoke = gridControl}; XtraGridContextMenu xtraGridContextMenu = new XtraGridContextMenu(); xtraGridContextMenu.SourceGrid = gridControl; gridControl.ContextMenuStrip = xtraGridContextMenu; WindowsFormsTestHelper windowsFormsTestHelper = new WindowsFormsTestHelper(); windowsFormsTestHelper.ShowControl(gridControl); Assert.AreEqual(3,gridControl.DefaultView.RowCount); }