Beispiel #1
0
        public void Test_Construct()
        {
            //--------------- Set up test pack ------------------
            IControlFactory   controlFactory   = GetControlFactory();
            IExtendedComboBox extendedComboBox = CreateExtendedComboBox();
            string            propName         = TestUtil.GetRandomString();
            //--------------- Test Preconditions ----------------

            //--------------- Execute Test ----------------------
            ExtendedComboBoxMapper mapper = new ExtendedComboBoxMapper(
                extendedComboBox, propName, false, controlFactory);

            //--------------- Test Result -----------------------
            Assert.IsInstanceOf(typeof(IControlMapper), mapper);
            Assert.AreSame(extendedComboBox, mapper.Control);
            Assert.AreEqual(propName, mapper.PropertyName);
            Assert.AreEqual(false, mapper.IsReadOnly);
            Assert.AreEqual(controlFactory, mapper.ControlFactory);
            ExtendedComboBoxMapper lookupComboBoxMapper = mapper;

            Assert.IsNotNull(lookupComboBoxMapper);
//            Assert.AreSame(extendedComboBox.ComboBox, lookupComboBoxMapper.Control);
            Assert.AreSame(extendedComboBox, lookupComboBoxMapper.Control);
            Assert.AreEqual(propName, lookupComboBoxMapper.PropertyName);
            Assert.AreEqual(false, lookupComboBoxMapper.IsReadOnly);
            Assert.AreEqual(controlFactory, lookupComboBoxMapper.ControlFactory);
            Assert.AreEqual(lookupComboBoxMapper.ErrorProvider, mapper.ErrorProvider);
        }
Beispiel #2
0
        public void Test_ItemsShowingInComboBox()
        {
            //--------------- Set up test pack ------------------

            ContactPersonTestBO contactPersonTestBO = new ContactPersonTestBO();

            contactPersonTestBO.Surname   = TestUtil.GetRandomString();
            contactPersonTestBO.FirstName = TestUtil.GetRandomString();
            OrganisationTestBO.LoadDefaultClassDef();
            OrganisationTestBO.CreateSavedOrganisation();
            OrganisationTestBO.CreateSavedOrganisation();

            IControlFactory        controlFactory   = GetControlFactory();
            IExtendedComboBox      extendedComboBox = CreateExtendedComboBox();
            const string           propName         = "OrganisationID";
            ExtendedComboBoxMapper mapper           = new ExtendedComboBoxMapper(
                extendedComboBox, propName, true, controlFactory);

            //--------------- Test Preconditions ----------------
            Assert.IsNull(mapper.BusinessObject);
            Assert.IsNull(mapper.BusinessObject);

            //--------------- Execute Test ----------------------
            mapper.BusinessObject = contactPersonTestBO;
            //--------------- Test Result -----------------------
            Assert.AreSame(contactPersonTestBO, mapper.BusinessObject);
            Assert.AreSame(contactPersonTestBO, mapper.BusinessObject);
            Assert.AreEqual(2, mapper.LookupList.Count);
        }
Beispiel #3
0
        private ExtendedComboBoxMapper CreateExtendedLookupComboBoxMapper(string propertyName)
        {
            IControlFactory        controlFactory   = GetControlFactory();
            IExtendedComboBox      extendedComboBox = CreateExtendedComboBox();
            ExtendedComboBoxMapper mapper           = new ExtendedComboBoxMapper(
                extendedComboBox, propertyName, true, controlFactory);

            return(mapper);
        }
Beispiel #4
0
        public void Test_GetButton()
        {
            //--------------- Set up test pack ------------------
            IControlFactory   controlFactory   = GetControlFactory();
            IExtendedComboBox extendedComboBox = controlFactory.CreateExtendedComboBox();
            //--------------- Test Preconditions ----------------

            //--------------- Execute Test ----------------------
            IButton button = extendedComboBox.Button;

            //--------------- Test Result -----------------------
            Assert.IsNotNull(button);
        }
 ///<summary>
 /// Constructs the mapper for <see cref="IExtendedComboBox"/>.
 ///</summary>
 public ExtendedComboBoxMapper
     (IExtendedComboBox ctl, string propName, bool isReadOnly, IControlFactory controlFactory)
     : base(ctl, propName, isReadOnly, controlFactory)
 {
     ExtendedComboBox = ctl;
     LookupComboBoxMapper = new LookupComboBoxMapper
         (ExtendedComboBox.ComboBox, propName, isReadOnly, controlFactory);
     ExtendedComboBox.Button.Click += delegate
         {
             ShowPopupForm();
             PopupForm.Closed += HandlePopUpFormClosedEvent;
          
             PopupForm.ShowDialog();
         };
 }
Beispiel #6
0
        ///<summary>
        /// Constructs the mapper for <see cref="IExtendedComboBox"/>.
        ///</summary>
        public ExtendedComboBoxMapper
            (IExtendedComboBox ctl, string propName, bool isReadOnly, IControlFactory controlFactory)
            : base(ctl, propName, isReadOnly, controlFactory)
        {
            ExtendedComboBox     = ctl;
            LookupComboBoxMapper = new LookupComboBoxMapper
                                       (ExtendedComboBox.ComboBox, propName, isReadOnly, controlFactory);
            ExtendedComboBox.Button.Click += delegate
            {
                ShowPopupForm();
                PopupForm.Closed += HandlePopUpFormClosedEvent;

                PopupForm.ShowDialog();
            };
        }
Beispiel #7
0
        public void Test_ShowGridAndBOEditorControlWinWithSuperClassDef()
        {
            //--------------- Set up test pack ------------------
            ClassDef.ClassDefs.Clear();
            PersonTestBO.LoadDefaultClassDefWithTestOrganisationBOLookup();
            ContactPersonTestBO.LoadDefaultClassDefWithPersonTestBOSuperClass();
            BusinessObjectCollection <OrganisationTestBO> organisationTestBOS = CreateSavedOrganisationTestBOSCollection();


            IControlFactory        controlFactory   = GetControlFactory();
            IExtendedComboBox      extendedComboBox = CreateExtendedComboBox();
            const string           propName         = "OrganisationID";
            ExtendedComboBoxMapper mapper           = new ExtendedComboBoxMapper(
                extendedComboBox, propName, true, controlFactory);

            mapper.BusinessObject = new ContactPersonTestBO();
            // mapper.RelatedBusinessObject = OrganisationTestBO.CreateSavedOrganisation();
            //--------------- Test Preconditions ----------------
            Assert.IsNull(mapper.PopupForm);
            //--------------- Execute Test ----------------------
            //extendedComboBox.Button.PerformClick();
            mapper.ShowPopupForm();
            //--------------- Test Result -----------------------
            Assert.IsNotNull(mapper.PopupForm);
            IFormHabanero form = mapper.PopupForm;

            Assert.AreEqual(800, form.Width);
            Assert.AreEqual(600, form.Height);
            Assert.AreEqual(1, form.Controls.Count);
            Assert.AreEqual(DockStyle.Fill, form.Controls[0].Dock);

            Assert.IsInstanceOf(typeof(IBOGridAndEditorControl), form.Controls[0]);
            IBOGridAndEditorControl andBOGridAndEditorControlWin = (IBOGridAndEditorControl)form.Controls[0];

            //Assert.AreSame(mapper.BusinessObject, BOGridAndEditorControlWin.BOEditorControlWin.BusinessObject);
            Assert.IsTrue(andBOGridAndEditorControlWin.GridControl.IsInitialised);
            IBusinessObjectCollection collection = andBOGridAndEditorControlWin.GridControl.Grid.BusinessObjectCollection;

            Assert.IsNotNull(collection);
            Assert.AreEqual(organisationTestBOS.Count, collection.Count);
            Assert.AreEqual(organisationTestBOS.Count, mapper.LookupList.Count);
        }
Beispiel #8
0
        public void Test_Layout()
        {
            //--------------- Set up test pack-------------------
            IControlFactory controlFactory = GetControlFactory();
            //--------------- Test Preconditions ----------------

            //--------------- Execute Test ----------------------
            IExtendedComboBox extendedComboBox = controlFactory.CreateExtendedComboBox();

            //--------------- Test Result -----------------------
            Assert.AreEqual(2, extendedComboBox.Controls.Count);
            IControlHabanero control1 = extendedComboBox.Controls[0];
            IControlHabanero control2 = extendedComboBox.Controls[1];

            Assert.IsInstanceOf(typeof(IComboBox), control1);
            Assert.IsInstanceOf(typeof(IButton), control2);
            Assert.AreEqual("...", control2.Text);
            Assert.AreEqual(0, control1.Left);
            Assert.LessOrEqual(control1.Width, control2.Left);
            Assert.GreaterOrEqual(extendedComboBox.Width, control2.Left + control2.Width);
        }
Beispiel #9
0
 public ExtendedComboBoxMapperSpy(IExtendedComboBox ctl, string propName, bool isReadOnly, IControlFactory controlFactory) : base(ctl, propName, isReadOnly, controlFactory)
 {
 }
 public ExtendedComboBoxMapperSpy(IExtendedComboBox ctl, string propName, bool isReadOnly, IControlFactory controlFactory) : base(ctl, propName, isReadOnly, controlFactory)
 {
 }