Ejemplo n.º 1
0
        public void TestCreateEditableGridButtonsControl()
        {
            //---------------Set up test pack-------------------
            //---------------Execute Test ----------------------
            IEditableGridButtonsControl editableGridButtonsControl = GetControlFactory().CreateEditableGridButtonsControl();

            //---------------Test Result ----------------------
            Assert.IsNotNull(editableGridButtonsControl);
            Assert.IsInstanceOfType(typeof(IEditableGridButtonsControl), editableGridButtonsControl);
        }
Ejemplo n.º 2
0
        public void TestSaveButtonClick()
        {
            //---------------Set up test pack-------------------
            IEditableGridButtonsControl buttonsControl = GetControlFactory().CreateEditableGridButtonsControl();
            //AddControlToForm(readOnlyGridButtonsControl);
            IButton btn         = buttonsControl["Save"];
            bool    saveClicked = false;

            buttonsControl.SaveClicked += delegate { saveClicked = true; };
            //---------------Execute Test ----------------------
            btn.PerformClick();

            //---------------Test Result ----------------------
            Assert.IsTrue(saveClicked);
        }
 ///<summary>
 /// Constructs a new instance of a <see cref="EditableGridControlWin"/>.
 ///</summary>
 ///<param name="controlFactory">The <see cref="IControlFactory"/> to use to construct the control.</param>
 public EditableGridControlWin(IControlFactory controlFactory)
 {
     if (controlFactory == null)
         throw new HabaneroArgumentException
             ("controlFactory", "Cannot create an editable grid control if the control factory is null");
     _controlFactory = controlFactory;
     _grid = _controlFactory.CreateEditableGrid();
     _editableGridManager = new EditableGridControlManager(this, controlFactory);
     _buttons = _controlFactory.CreateEditableGridButtonsControl();
     _filterControl = _controlFactory.CreateFilterControl();
     InitialiseButtons();
     InitialiseFilterControl();
     BorderLayoutManager layoutManager = controlFactory.CreateBorderLayoutManager(this);
     layoutManager.AddControl(_filterControl, BorderLayoutManager.Position.North);
     layoutManager.AddControl(_grid, BorderLayoutManager.Position.Centre);
     layoutManager.AddControl(_buttons, BorderLayoutManager.Position.South);
     this.Grid.BusinessObjectSelected += Grid_OnBusinessObjectSelected;
     this.AllowUsersToAddBO = true;
 }
Ejemplo n.º 4
0
        ///<summary>
        /// Constructs a new instance of a <see cref="EditableGridControlWin"/>.
        ///</summary>
        ///<param name="controlFactory">The <see cref="IControlFactory"/> to use to construct the control.</param>
        public EditableGridControlWin(IControlFactory controlFactory)
        {
            if (controlFactory == null)
            {
                throw new HabaneroArgumentException
                          ("controlFactory", "Cannot create an editable grid control if the control factory is null");
            }
            _controlFactory      = controlFactory;
            _grid                = _controlFactory.CreateEditableGrid();
            _editableGridManager = new EditableGridControlManager(this, controlFactory);
            _buttons             = _controlFactory.CreateEditableGridButtonsControl();
            _filterControl       = _controlFactory.CreateFilterControl();
            InitialiseButtons();
            InitialiseFilterControl();
            BorderLayoutManager layoutManager = controlFactory.CreateBorderLayoutManager(this);

            layoutManager.AddControl(_filterControl, BorderLayoutManager.Position.North);
            layoutManager.AddControl(_grid, BorderLayoutManager.Position.Centre);
            layoutManager.AddControl(_buttons, BorderLayoutManager.Position.South);
            this.Grid.BusinessObjectSelected += Grid_OnBusinessObjectSelected;
            this.AllowUsersToAddBO            = true;
        }
Ejemplo n.º 5
0
        public void TestCreateEditableGridButtonsControl_TestButtonsAdded()
        {
            //---------------Set up test pack-------------------
            //---------------Execute Test ----------------------
            IEditableGridButtonsControl buttonsControl = GetControlFactory().CreateEditableGridButtonsControl();

            //---------------Test Result ----------------------
            //IReadOnlyGridButtonsControl readOnlyGridButtonsControl = (IReadOnlyGridButtonsControl)grid;
            // AddControlToForm(buttonsControl);
            //Cancel button should be first (This is right aligned so that means it will be furthest right if visible
            Assert.AreEqual(2, buttonsControl.Controls.Count);
            IButton btn = (IButton)buttonsControl.Controls[0];

            Assert.IsNotNull(btn);
            Assert.AreEqual("Cancel", btn.Name);
            Assert.IsTrue(btn.Visible);

            //Save button should be second (This is right aligned so that means it will be second from left
            btn = (IButton)buttonsControl.Controls[1];
            Assert.IsNotNull(btn);
            Assert.AreEqual("Save", btn.Name);
            Assert.IsTrue(btn.Visible);
        }
Ejemplo n.º 6
0
        public void TestCreateEditableGridButtonsControl_GetControlUsingIndexer()
        {
            //---------------Set up test pack-------------------
            //---------------Execute Test ----------------------
            IEditableGridButtonsControl buttonsControl = GetControlFactory().CreateEditableGridButtonsControl();

            //---------------Test Result ----------------------

            Assert.AreEqual(2, buttonsControl.Controls.Count);

            //Cancel Visible and Text Correct
            IButton btn = buttonsControl["Cancel"];

            Assert.IsNotNull(btn);
            Assert.AreEqual("Cancel", btn.Name);
            Assert.IsTrue(btn.Visible);

            //Save Visible and Text Correct
            btn = buttonsControl["Save"];
            Assert.IsNotNull(btn);
            Assert.AreEqual("Save", btn.Text);
            Assert.IsTrue(btn.Visible);
        }