Beispiel #1
0
        public void Creating_MessageBox_With_Duplicate_Key_Should_Return_The_Same_One()
        {
            var msg1 = FAMessageBoxManager.CreateMessageBox("Test");
            var msg2 = FAMessageBoxManager.CreateMessageBox("Test");

            Assert.AreEqual(msg1, msg2);
            Assert.AreSame(msg1, msg2);
        }
Beispiel #2
0
        public void Get_Message_Box_Should_Return_Null_When_Key_Not_Found()
        {
            var msg = FAMessageBoxManager.CreateMessageBox("Test");

            FAMessageBoxManager.DeleteMessageBox("Test");

            var msg2 = FAMessageBoxManager.GetMessageBox("Test");

            Assert.Null(msg2);
        }
Beispiel #3
0
        public void Creating_MessageBox_With_Duplicate_Key_Should_Return_Another_One_When_Disposed()
        {
            var msg = FAMessageBoxManager.CreateMessageBox("Test");

            ((IDisposable)msg).Dispose();
            Assert.True(msg.IsDisposed);

            msg = FAMessageBoxManager.CreateMessageBox("Test");
            Assert.False(msg.IsDisposed);
        }
Beispiel #4
0
        public void Delete_NonExisting_MessageBox()
        {
            var msgboxName = Guid.NewGuid().ToString();
            var result     = FAMessageBoxManager.DeleteMessageBox(msgboxName);

            Assert.False(result);

            FAMessageBoxManager.CreateMessageBox(msgboxName);
            result = FAMessageBoxManager.DeleteMessageBox(msgboxName);
            Assert.True(result);
        }
Beispiel #5
0
        private void btnGetAdv_Click(object sender, EventArgs e)
        {
            FAMessageBox msg = FAMessageBoxManager.GetMessageBox(DEF_ADVBUTTON_MESSAGEBOX);

            if (msg == null || !msg.SavedResponse)
            {
                lblMessage.Text = "Advanced MessageBox is not shown yet or has not its value saved.";
            }
            else
            {
                lblMessage.Text = string.Format("You've selected {0} from Advanced MessageBox before.", msg.Show());
            }
        }
Beispiel #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            FAMessageBox msg;

            msg = FAMessageBoxManager.GetMessageBox(DEF_BASIC_MESSAGEBOX);
            if (FAMessageBoxManager.GetMessageBox(DEF_BASIC_MESSAGEBOX) == null)
            {
                msg = FAMessageBoxManager.CreateMessageBox(DEF_BASIC_MESSAGEBOX, true);
                msg.AddButtons(MessageBoxButtons.YesNo);
            }

            msg.AllowSaveResponse = true;
            msg.SaveResponseText  = "سوال را تکرار نکن";
            msg.Text      = "ایا موافق هستید";
            msg.Caption   = "سوال";
            msg.Icon      = FarsiMessageBoxExIcon.Exclamation;
            msg.PlaySound = true;
            string value = msg.Show();

            lblMessage.Text = string.Format("You've selected {0} in Basic MessageBox.", value);
        }
Beispiel #7
0
        private void btnCustom_Click(object sender, EventArgs e)
        {
            FAMessageBox msg;

            msg = FAMessageBoxManager.GetMessageBox(DEF_ADVBUTTON_MESSAGEBOX);
            if (FAMessageBoxManager.GetMessageBox(DEF_ADVBUTTON_MESSAGEBOX) == null)
            {
                msg = FAMessageBoxManager.CreateMessageBox(DEF_ADVBUTTON_MESSAGEBOX);
                msg.AddButton(new FAMessageBoxButton("Yes", "YES"));
                msg.AddButton(new FAMessageBoxButton("No", "NO"));
                msg.AddButton(new FAMessageBoxButton("Yes To All", "YESTOALL"));
                msg.AddButton(new FAMessageBoxButton("No To All", "NOTOALL"));
            }

            msg.AllowSaveResponse = true;
            msg.SaveResponseText  = "Don't ask this question again.";
            msg.Text = "This file already exists. Overwrite?";
            msg.Icon = FarsiMessageBoxExIcon.Question;
            string value = msg.Show(this);

            lblMessage.Text = string.Format("You've selected {0} in Advanced MessageBox.", value);
        }
Beispiel #8
0
 public void Delete_Message_Box_By_Providing_Null_As_Name_Throws()
 {
     Assert.Throws(typeof(InvalidOperationException), () => FAMessageBoxManager.DeleteMessageBox(null));
 }
Beispiel #9
0
 public void Should_Specify_MessageBox_Name_When_Creating_One()
 {
     Assert.Throws(typeof(InvalidOperationException), () => FAMessageBoxManager.CreateMessageBox(string.Empty));
 }