Inheritance: Habanero.Faces.Base.ExtendedTextBoxMapper
Exemplo n.º 1
0
        public void Test_SelectButtonWhenClicked_ShouldApplyBusinessObjectChanges()
        {
            //---------------Set up test pack-------------------
            GetClassDefs();
            IControlFactory          controlFactory     = GetControlFactory();
            ExtendedTextBoxVWG       extendedTextBoxVWG = new ExtendedTextBoxVWG(controlFactory);
            const string             propName           = "OrganisationID";
            ExtendedTextBoxMapperSpy mapperSpy          = new ExtendedTextBoxMapperSpy(
                extendedTextBoxVWG, propName, true, controlFactory);
            ContactPersonTestBO contactPersonTestBo = new ContactPersonTestBO();

            mapperSpy.BusinessObject = contactPersonTestBo;
            var expectedSelectedBO = new OrganisationTestBO();

            //---------------Assert Precondition----------------
            Assert.AreSame(contactPersonTestBo, mapperSpy.BusinessObject);
            Assert.IsNull(contactPersonTestBo.OrganisationID);
            //---------------Execute Test ----------------------
            mapperSpy.CallSetupPopupForm();
            mapperSpy.SetSelectedBusinessObject(expectedSelectedBO);
            mapperSpy.CallSelectClick();
            //---------------Test Result -----------------------
            Assert.IsNotNull(contactPersonTestBo.OrganisationID);
            Assert.AreSame(expectedSelectedBO, contactPersonTestBo.Organisation);
        }
Exemplo n.º 2
0
        public void Test_SetupPopupForm_WithSuperClassDef_ShouldSetUpThePopUpForm()
        {
            //--------------- Set up test pack ------------------
            BusinessObjectCollection <OrganisationTestBO> organisationTestBOs = GetClassDefs();

            IControlFactory          controlFactory     = GetControlFactory();
            ExtendedTextBoxVWG       extendedTextBoxVWG = new ExtendedTextBoxVWG(controlFactory);
            const string             propName           = "OrganisationID";
            ExtendedTextBoxMapperSpy mapper             = new ExtendedTextBoxMapperSpy(
                extendedTextBoxVWG, propName, true, controlFactory);

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

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

            Assert.IsInstanceOf(typeof(IBOGridAndEditorControl), form.Controls[0]);
            Assert.IsInstanceOf(typeof(BOGridAndEditorControlVWG), form.Controls[0]);
            Assert.IsInstanceOf <IButtonGroupControl>(form.Controls[1]);

            IButtonGroupControl control = (IButtonGroupControl)form.Controls[1];

            Assert.AreEqual("Cancel", control.Controls[0].Text);
            Assert.AreEqual("Select", control.Controls[1].Text);

            BOGridAndEditorControlVWG andBOGridAndEditorControlVWG = (BOGridAndEditorControlVWG)form.Controls[0];

            //Assert.AreSame(mapper.BusinessObject, BOGridAndEditorControlVWG.BOEditorControlVWG.BusinessObject);
            Assert.IsTrue(andBOGridAndEditorControlVWG.GridControl.IsInitialised);
            IBusinessObjectCollection collection = andBOGridAndEditorControlVWG.GridControl.Grid.BusinessObjectCollection;

            Assert.IsNotNull(collection);
            Assert.AreEqual(organisationTestBOs.Count, collection.Count);
            //            Assert.AreEqual(organisationTestBOs.Count, mapper.LookupList.Count);
        }
Exemplo n.º 3
0
        public void Test_CancelButton_WhenClicked_ShouldCancelEditsAndCloseForm()
        {
            //---------------Set up test pack-------------------
            GetClassDefs();
            IControlFactory          controlFactory     = GetControlFactory();
            ExtendedTextBoxVWG       extendedTextBoxVWG = new ExtendedTextBoxVWG(controlFactory);
            const string             propName           = "OrganisationID";
            ExtendedTextBoxMapperSpy mapper             = new ExtendedTextBoxMapperSpy(
                extendedTextBoxVWG, propName, true, controlFactory);

            mapper.BusinessObject = new ContactPersonTestBO();
            mapper.CallSetupPopupForm();
            //---------------Assert Precondition----------------
            Assert.IsFalse(mapper.FormClosed);
            //---------------Execute Test ----------------------
            mapper.CallCancelClick();
            //---------------Test Result -----------------------
            Assert.IsTrue(mapper.FormClosed);
        }
Exemplo n.º 4
0
        public void Test_SelectButtonWhenClicked_ShouldClosePopupForm()
        {
            GetClassDefs();
            IControlFactory          controlFactory     = GetControlFactory();
            ExtendedTextBoxVWG       extendedTextBoxVWG = new ExtendedTextBoxVWG(controlFactory);
            const string             propName           = "OrganisationID";
            ExtendedTextBoxMapperSpy mapperSpy          = new ExtendedTextBoxMapperSpy(
                extendedTextBoxVWG, propName, true, controlFactory);
            ContactPersonTestBO contactPersonTestBo = new ContactPersonTestBO();

            mapperSpy.BusinessObject = contactPersonTestBo;
            //---------------Assert Precondition----------------
            Assert.IsFalse(mapperSpy.FormClosed);
            //---------------Execute Test ----------------------
            mapperSpy.CallSetupPopupForm();
            mapperSpy.CallSelectClick();
            //---------------Test Result -----------------------
            Assert.IsTrue(mapperSpy.FormClosed);
        }
Exemplo n.º 5
0
        public void Test_SelectButtonWhenClicked_AndContactPersonNotValid_ShouldCloseWithoutError_FixBugBug541()
        {
            GetClassDefs();
            IControlFactory          controlFactory     = GetControlFactory();
            ExtendedTextBoxVWG       extendedTextBoxVWG = new ExtendedTextBoxVWG(controlFactory);
            const string             propName           = "OrganisationID";
            ExtendedTextBoxMapperSpy mapperSpy          = new ExtendedTextBoxMapperSpy(
                extendedTextBoxVWG, propName, true, controlFactory);
            ContactPersonTestBO contactPersonTestBo = new ContactPersonTestBO();

            mapperSpy.BusinessObject = contactPersonTestBo;
            mapperSpy.SelectedBO     = new OrganisationTestBO();
            //---------------Assert Precondition----------------
            Assert.IsFalse(mapperSpy.FormClosed);
            Assert.IsFalse(contactPersonTestBo.Status.IsValid());
            Assert.IsTrue(mapperSpy.SelectedBO.Status.IsValid());
            Assert.IsNotNull(mapperSpy.SelectedBO);
            //---------------Execute Test ----------------------
            mapperSpy.CallSetupPopupForm();
            mapperSpy.CallSelectClick();
            //---------------Test Result -----------------------
            Assert.IsFalse(contactPersonTestBo.Status.IsValid());
            Assert.IsTrue(mapperSpy.FormClosed);
        }
 public void Test_CancelButton_WhenClicked_ShouldCancelEditsAndCloseForm()
 {
     //---------------Set up test pack-------------------
     GetClassDefs();
     IControlFactory controlFactory = GetControlFactory();
     ExtendedTextBoxVWG extendedTextBoxVWG = new ExtendedTextBoxVWG(controlFactory);
     const string propName = "OrganisationID";
     ExtendedTextBoxMapperSpy mapper = new ExtendedTextBoxMapperSpy(
         extendedTextBoxVWG, propName, true, controlFactory);
     mapper.BusinessObject = new ContactPersonTestBO();
     mapper.CallSetupPopupForm();
     //---------------Assert Precondition----------------
     Assert.IsFalse(mapper.FormClosed);
     //---------------Execute Test ----------------------
     mapper.CallCancelClick();
     //---------------Test Result -----------------------
     Assert.IsTrue(mapper.FormClosed);
 }
 public void Test_SelectButtonWhenClicked_AndContactPersonNotValid_ShouldCloseWithoutError_FixBugBug541()
 {
     GetClassDefs();
     IControlFactory controlFactory = GetControlFactory();
     ExtendedTextBoxVWG extendedTextBoxVWG = new ExtendedTextBoxVWG(controlFactory);
     const string propName = "OrganisationID";
     ExtendedTextBoxMapperSpy mapperSpy = new ExtendedTextBoxMapperSpy(
         extendedTextBoxVWG, propName, true, controlFactory);
     ContactPersonTestBO contactPersonTestBo = new ContactPersonTestBO();
     mapperSpy.BusinessObject = contactPersonTestBo;
     mapperSpy.SelectedBO = new OrganisationTestBO();
     //---------------Assert Precondition----------------
     Assert.IsFalse(mapperSpy.FormClosed);
     Assert.IsFalse(contactPersonTestBo.Status.IsValid());
     Assert.IsTrue(mapperSpy.SelectedBO.Status.IsValid());
     Assert.IsNotNull(mapperSpy.SelectedBO);
     //---------------Execute Test ----------------------
     mapperSpy.CallSetupPopupForm();
     mapperSpy.CallSelectClick();
     //---------------Test Result -----------------------
     Assert.IsFalse(contactPersonTestBo.Status.IsValid());
     Assert.IsTrue(mapperSpy.FormClosed);
 }
 public void Test_SelectButtonWhenClicked_ShouldClosePopupForm()
 {
     GetClassDefs();
     IControlFactory controlFactory = GetControlFactory();
     ExtendedTextBoxVWG extendedTextBoxVWG = new ExtendedTextBoxVWG(controlFactory);
     const string propName = "OrganisationID";
     ExtendedTextBoxMapperSpy mapperSpy = new ExtendedTextBoxMapperSpy(
         extendedTextBoxVWG, propName, true, controlFactory);
     ContactPersonTestBO contactPersonTestBo = new ContactPersonTestBO();
     mapperSpy.BusinessObject = contactPersonTestBo;
     //---------------Assert Precondition----------------
     Assert.IsFalse(mapperSpy.FormClosed);
     //---------------Execute Test ----------------------
     mapperSpy.CallSetupPopupForm();
     mapperSpy.CallSelectClick();
     //---------------Test Result -----------------------
     Assert.IsTrue(mapperSpy.FormClosed);
 }
 public void Test_SelectButtonWhenClicked_ShouldApplyBusinessObjectChanges()
 {
     //---------------Set up test pack-------------------
     GetClassDefs();
     IControlFactory controlFactory = GetControlFactory();
     ExtendedTextBoxVWG extendedTextBoxVWG = new ExtendedTextBoxVWG(controlFactory);
     const string propName = "OrganisationID";
     ExtendedTextBoxMapperSpy mapperSpy = new ExtendedTextBoxMapperSpy(
         extendedTextBoxVWG, propName, true, controlFactory);
     ContactPersonTestBO contactPersonTestBo = new ContactPersonTestBO();
     mapperSpy.BusinessObject = contactPersonTestBo;
     var expectedSelectedBO = new OrganisationTestBO();
     //---------------Assert Precondition----------------
     Assert.AreSame(contactPersonTestBo, mapperSpy.BusinessObject);
     Assert.IsNull(contactPersonTestBo.OrganisationID);
     //---------------Execute Test ----------------------
     mapperSpy.CallSetupPopupForm();
     mapperSpy.SetSelectedBusinessObject(expectedSelectedBO);
     mapperSpy.CallSelectClick();
     //---------------Test Result -----------------------
     Assert.IsNotNull(contactPersonTestBo.OrganisationID);
     Assert.AreSame(expectedSelectedBO, contactPersonTestBo.Organisation);
 }
        public void Test_SetupPopupForm_WithSuperClassDef_ShouldSetUpThePopUpForm()
        {
            //--------------- Set up test pack ------------------
            BusinessObjectCollection<OrganisationTestBO> organisationTestBOs = GetClassDefs();

            IControlFactory controlFactory = GetControlFactory();
            ExtendedTextBoxVWG extendedTextBoxVWG = new ExtendedTextBoxVWG(controlFactory);
            const string propName = "OrganisationID";
            ExtendedTextBoxMapperSpy mapper = new ExtendedTextBoxMapperSpy(
                extendedTextBoxVWG, propName, true, controlFactory);
            mapper.BusinessObject = new ContactPersonTestBO();
            // mapper.RelatedBusinessObject = OrganisationTestBO.CreateSavedOrganisation();
            //--------------- Test Preconditions ----------------
            Assert.IsNull(mapper.PopupForm);
            //--------------- Execute Test ----------------------
            //extendedTextBoxVWG.Button.PerformClick();
            mapper.CallSetupPopupForm();
            //--------------- Test Result -----------------------
            Assert.IsNotNull(mapper.PopupForm);
            IFormHabanero form = mapper.PopupForm;
            Assert.AreEqual(800, form.Width);
            Assert.AreEqual(600, form.Height);
            Assert.AreEqual(2, form.Controls.Count);
            Assert.AreEqual(DockStyle.Fill, form.Controls[0].Dock);

            Assert.IsInstanceOf(typeof(IBOGridAndEditorControl), form.Controls[0]);
            Assert.IsInstanceOf(typeof(BOGridAndEditorControlVWG), form.Controls[0]);
            Assert.IsInstanceOf<IButtonGroupControl>(form.Controls[1]);

            IButtonGroupControl control = (IButtonGroupControl)form.Controls[1];
            Assert.AreEqual("Cancel", control.Controls[0].Text);
            Assert.AreEqual("Select", control.Controls[1].Text);

            BOGridAndEditorControlVWG andBOGridAndEditorControlVWG = (BOGridAndEditorControlVWG)form.Controls[0];
            //Assert.AreSame(mapper.BusinessObject, BOGridAndEditorControlVWG.BOEditorControlVWG.BusinessObject);
            Assert.IsTrue(andBOGridAndEditorControlVWG.GridControl.IsInitialised);
            IBusinessObjectCollection collection = andBOGridAndEditorControlVWG.GridControl.Grid.BusinessObjectCollection;
            Assert.IsNotNull(collection);
            Assert.AreEqual(organisationTestBOs.Count, collection.Count);
            //            Assert.AreEqual(organisationTestBOs.Count, mapper.LookupList.Count);
        }