Esempio n. 1
0
        //this is Currently untestable, the layout has been tested in the CreateControlPanel method.
        /// <summary>
        /// Shows the form to the user
        /// </summary>
        public DialogResult ShowDialog()
        {
            IPanel panel = createControlPanel();
            IOKCancelDialogFactory okCancelDialogFactory = _controlFactory.CreateOKCancelDialogFactory();
            IFormHabanero          form = okCancelDialogFactory.CreateOKCancelForm(panel, "");

            return(form.ShowDialog());
        }
        internal IFormHabanero CreateOKCancelForm()
        {
            IPanel panel = CreateControlPanel();
            IOKCancelDialogFactory okCancelDialogFactory = _controlFactory.CreateOKCancelDialogFactory();
            IFormHabanero          form = okCancelDialogFactory.CreateOKCancelForm(panel, "Select");

            form.MinimumSize     = form.Size;
            form.FormBorderStyle = FormBorderStyle.FixedToolWindow;
            return(form);
        }
        public void Test_CreateOKCancelForm_ShouldDockPanel()
        {
            //---------------Set up test pack-------------------
            IOKCancelDialogFactory okCancelDialogFactory = CreateOKCancelDialogFactory();
            //---------------Execute Test ----------------------
            IFormHabanero dialogForm = okCancelDialogFactory.CreateOKCancelForm(GetControlFactory().CreatePanel(), "");

            //---------------Test Result -----------------------
            Assert.AreEqual(1, dialogForm.Controls.Count);
            Assert.AreEqual(DockStyle.Fill, dialogForm.Controls[0].Dock);
        }
Esempio n. 4
0
        public void Test_CreateOKCancelForm_ShouldSetupOKButtonAsAcceptButton()
        {
            //---------------Set up test pack-------------------
            IOKCancelDialogFactory okCancelDialogFactory = CreateOKCancelDialogFactory();
            //---------------Execute Test ----------------------
            FormWin dialogForm = (FormWin)okCancelDialogFactory.CreateOKCancelForm(GetControlFactory().CreatePanel(), "");
            //---------------Test Result -----------------------
            IButtonGroupControl buttons = (IButtonGroupControl)dialogForm.Controls[0].Controls[1];

            Assert.AreSame(buttons["OK"], dialogForm.AcceptButton);
        }
        public void Test_CreateOKCancelForm_ShouldNotChangeControlSize()
        {
            //---------------Set up test pack-------------------
            IOKCancelDialogFactory okCancelDialogFactory = CreateOKCancelDialogFactory();
            IControlHabanero       nestedControl         = GetControlFactory().CreatePanel();
            int width  = TestUtil.GetRandomInt(100, 500);
            int height = TestUtil.GetRandomInt(100, 500);

            nestedControl.Size = new Size(width, height);
            //---------------Assert Precondition----------------
            Assert.AreEqual(width, nestedControl.Width);
            Assert.AreEqual(height, nestedControl.Height);
            //---------------Execute Test ----------------------
            IControlHabanero dialogControl = okCancelDialogFactory.CreateOKCancelForm(nestedControl, "MyTestForm");

            //---------------Test Result -----------------------
            Assert.AreEqual(width, nestedControl.Width, "Width should not have changed");
            Assert.GreaterOrEqual(nestedControl.Height, height, "Height should not have changed, but might have changed to be a bit bigger (due to how VWG works its fill docking)");
        }