public void SetUp() { launcher = new ApplicationLauncher(TimeSpan.Parse("00:00:30")); application = launcher.LaunchOrRecycle("Example.PetShop", @"Examples\Wpf\Example.PetShop.exe", null); WindowFactory.ControlConstructor = new WindowFactory.ConstructFromElement((controlType, element, name) => { Object[] parameters = new Object[2]; parameters[0] = element; parameters[1] = name; return ReflectionHelper.Instantiate(controlType.Assembly, controlType.FullName, parameters); }); }
public void AWaveform() { var launcher = new ApplicationLauncher(); app = launcher.Recycle("WaveformApp"); win = app.FindWindow("Waveform"); }
public void run_application() { var waitForApplicationStart = new ManualResetEvent(false); _thread = new Thread(() => { _app = new System.Windows.Application(); _app.Startup += (s, e) => { waitForApplicationStart.Set(); _app.MainWindow = new Window(); _app.MainWindow.ShowDialog(); }; _app.Run(); }); _thread.IsBackground = true; _thread.SetApartmentState(ApartmentState.STA); _thread.Name = "Application under testing"; _thread.Start(); waitForApplicationStart.WaitOne(); _dispatcher = Dispatcher.FromThread(_thread); _dispatcher.Invoke(new ThreadStart(() => _window = _app.MainWindow as TestApp.Window)); _process = Process.GetCurrentProcess(); _application = new Application(_process); _windowAutomation = _application.FindWindow("MainWindow"); // Thread.Sleep(TimeSpan.FromSeconds(20)); }
public void SetUp() { launcher = new ApplicationLauncher(TimeSpan.Parse("00:00:12")); application = launcher.LaunchOrRecycle("Example.PetShop.WinForms", @"Examples\WinForms\Example.PetShop.WinForms.exe", null); WindowFactory.ControlConstructor = new WindowFactory.ConstructFromElement((controlType, element, name) => { if (controlType.Namespace.Contains("WiPFlash")) { Object[] parameters = new Object[2]; parameters[0] = element; parameters[1] = name; return ReflectionHelper.Instantiate(controlType.Assembly, controlType.FullName, parameters); } else if (controlType.Namespace.Contains("TestStack.White")) { Object[] parameters = new Object[2]; parameters[0] = element; parameters[1] = new TestStack.White.UIItems.Actions.NullActionListener(); return ReflectionHelper.Instantiate(controlType.Assembly, controlType.FullName, parameters); } throw new CreatePlaceHeldControlFailedException(String.Format("Control Namespace Not Recognised!\nNamespace: {0}", controlType.Namespace), null); }); }