Beispiel #1
0
        public void RememberOkBox()
        {
            string name = "X";

            using (MessageBoxEx msgBox = MessageBoxExManager.CreateMessageBox(name))
            {
                msgBox.Caption = name;
                msgBox.Text    = "Blah blah blah?";

                msgBox.AddButtons(MessageBoxButtons.YesNo);

                msgBox.SaveResponseText  = "Don't ask me again";
                msgBox.UseSavedResponse  = false;
                msgBox.AllowSaveResponse = true;

                //click the yes button when the dialog comes up
                m_FormTest.ExpectModal(name, ConfirmModalByYesAndRemember, true);

                Assert.AreEqual("Yes", msgBox.Show());

                m_FormTest.ExpectModal(name, DoNothing, false /*don't expect it, because it should use our saved response*/);
                msgBox.UseSavedResponse = true;
                Assert.AreEqual("Yes", msgBox.Show());
            }
        }
Beispiel #2
0
        public void TimeoutOfNewBox()
        {
            string       name   = System.IO.Path.GetTempPath() /*just a hack to get a unique name*/;
            MessageBoxEx msgBox = MessageBoxExManager.CreateMessageBox(name);

            msgBox.Caption = "Question";
            msgBox.Text    = "Blah blah blah?";

            msgBox.AddButtons(MessageBoxButtons.YesNo);

            msgBox.Timeout       = 10;
            msgBox.TimeoutResult = TimeoutResult.Timeout;

            ExpectModal(name, "DoNothing", true);           //the nunitforms framework freaks out if we show a dialog with out warning it first
            Assert.AreEqual("Timeout", msgBox.Show());
        }