public void TestGetWindowsOnWpfApplication() { string currentAssemblyPath = Assembly.GetExecutingAssembly().Location; string currentAssemblyDir = Path.GetDirectoryName(currentAssemblyPath); string currentResourcesDir = Path.Combine(currentAssemblyDir, "Properties", "Resources"); string demoAppPath = Path.Combine(currentResourcesDir, "Tests.Eyes.Windows.WPF.exe"); Process demoApp = Process.Start(demoAppPath, "--show-popup"); Logger logger = new Logger(); logger.SetLogHandler(TestUtils.InitLogHandler()); int pid = demoApp.Id; try { Thread.Sleep(5000); WindowCaptureInfo[] windows = EyesWindowsBase.GetWindows(logger, pid); Assert.AreEqual(2, windows.Length, "number of windows"); Assert.AreEqual("Pop Up", windows[0].Caption, "popup caption"); Assert.AreEqual("Main Window", windows[1].Caption, "main window caption"); } finally { demoApp.Kill(); } }
public void TestCheckGetWindowsApi() { Process notepadProcess = Process.Start("notepad"); Logger logger = new Logger(); logger.SetLogHandler(TestUtils.InitLogHandler()); try { WindowCaptureInfo[] windows = EyesWindowsBase.GetWindows(logger, notepadProcess.Id, "Notepad"); } finally { notepadProcess.CloseMainWindow(); notepadProcess.Kill(); } }