public void TestNet() { Async async = new Async(); app[typeof(MessageBox), "Show", async]("Message", "Title", MessageBoxButtons.OK, MessageBoxIcon.Information); NativeMessageBox msg = new NativeMessageBox(main.WaitForNextModal()); Assert.AreEqual("Title", msg.Title); Assert.AreEqual("Message", msg.Message); msg.EmulateButtonClick("OK"); async.WaitForCompletion(); }
public string ButtonEntry_EmulateClickAndGetMessage() { Async async = new Async(); ButtonEntry.EmulateClick(async); var msgBox = new NativeMessageBox(Window.WaitForNextModal()); var msg = msgBox.Message; msgBox.EmulateButtonClick("OK"); async.WaitForCompletion(); return msg; }
public void TestNative() { Async async = new Async(); app[GetType(), "MessageBoxA", async](0, "Message", "Title", 0); NativeMessageBox msg = new NativeMessageBox(WindowControl.WaitForIdentifyFromWindowText(app, "Title")); Assert.AreEqual("Title", msg.Title); Assert.AreEqual("Message", msg.Message); msg.EmulateButtonClick("OK"); async.WaitForCompletion(); }
public void ButtonClickAsyncTest() { // Arrenge dynamic main = _app.Type<Application>().Current.MainWindow; AppVar buttonCore = _app.Type<Button>()(); main._grid.Children.Add(buttonCore); dynamic checker = _app.Type<ButtonEventCheck>()(buttonCore, true); WindowControl windowControl = WindowControl.FromZTop(_app); WPFButtonBase ButtonBase = new WPFButtonBase(buttonCore); // Act Async async = new Async(); ButtonBase.EmulateClick(async); // Assert WindowControl messageBoxControl = windowControl.WaitForNextModal(); NativeMessageBox messageBox = new NativeMessageBox(messageBoxControl); Assert.AreEqual("TestMessageWindow", messageBox.Message); Assert.IsTrue((bool)checker.ButtonClickCalled); // Teardown messageBox.EmulateButtonClick("OK"); messageBoxControl.WaitForDestroy(); async.WaitForCompletion(); }