Esempio n. 1
0
        public void Test_Construct()
        {
            //--------------- Set up test pack ------------------
            IControlFactory    controlFactory     = GetControlFactory();
            ExtendedTextBoxWin extendedTextBoxWin = new ExtendedTextBoxWin(controlFactory);
            string             propName           = TestUtil.GetRandomString();
            //--------------- Test Preconditions ----------------

            //--------------- Execute Test ----------------------
            ExtendedTextBoxMapper mapper = new ExtendedTextBoxMapper(
                extendedTextBoxWin, propName, false, controlFactory);

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

            Assert.IsNotNull(lookupComboBoxMapper);
            Assert.AreSame(extendedTextBoxWin, lookupComboBoxMapper.Control);
            Assert.AreEqual(propName, lookupComboBoxMapper.PropertyName);
            Assert.AreEqual(false, lookupComboBoxMapper.IsReadOnly);
            Assert.AreEqual(controlFactory, lookupComboBoxMapper.ControlFactory);
            Assert.AreEqual(lookupComboBoxMapper.ErrorProvider, mapper.ErrorProvider);
        }
Esempio n. 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();
            ExtendedTextBoxWin    extendedTextBoxWin = new ExtendedTextBoxWin(controlFactory);
            const string          propName           = "OrganisationID";
            ExtendedTextBoxMapper mapper             = new ExtendedTextBoxMapper(
                extendedTextBoxWin, 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);
        }
Esempio n. 3
0
        private static ExtendedTextBoxMapper CreateExtendedLookupComboBoxMapper(string propertyName)
        {
            IControlFactory       controlFactory     = GetControlFactory();
            ExtendedTextBoxWin    extendedTextBoxWin = new ExtendedTextBoxWin(controlFactory);
            ExtendedTextBoxMapper mapper             = new ExtendedTextBoxMapper(
                extendedTextBoxWin, propertyName, true, controlFactory);

            return(mapper);
        }
Esempio n. 4
0
        public void Test_SetBusinessObject_ToNull_OnInternalLookupComboBoxMapper()
        {
            //--------------- Set up test pack ------------------
            ExtendedTextBoxMapper mapper = CreateExtendedLookupComboBoxMapper("Surname");

            //--------------- Test Preconditions ----------------
            Assert.IsNull(mapper.BusinessObject);
            Assert.IsNull(mapper.BusinessObject);
            //--------------- Execute Test ----------------------
            mapper.BusinessObject = null;
            //--------------- Test Result -----------------------
            Assert.AreSame(null, mapper.BusinessObject);
        }
Esempio n. 5
0
        public void Test_SetBusinessObject_OnInternalLookupComboBoxMapper()
        {
            //--------------- Set up test pack ------------------
            ExtendedTextBoxMapper mapper = CreateExtendedLookupComboBoxMapper("Surname");

            //--------------- Test Preconditions ----------------
            Assert.IsNull(mapper.BusinessObject);
            Assert.IsNull(mapper.BusinessObject);
            ContactPersonTestBO businessObjectInfo = new ContactPersonTestBO();

            //--------------- Execute Test ----------------------
            mapper.BusinessObject = businessObjectInfo;
            //--------------- Test Result -----------------------
            Assert.AreSame(businessObjectInfo, mapper.BusinessObject);
        }
Esempio n. 6
0
        public void Test_SetBusinessObject()
        {
            //--------------- Set up test pack ------------------
            ExtendedTextBoxMapper mapper = CreateExtendedLookupComboBoxMapper("TestProp");

            //--------------- Test Preconditions ----------------
            Assert.IsNull(mapper.BusinessObject);
            Assert.IsNull(mapper.BusinessObject);
            MyBO.LoadClassDefWithBOLookup();
            MyBO myBO = new MyBO();

            //--------------- Execute Test ----------------------
            mapper.BusinessObject = myBO;
            //--------------- Test Result -----------------------
            Assert.AreSame(myBO, mapper.BusinessObject);
            Assert.AreSame(myBO, mapper.BusinessObject);
        }
Esempio n. 7
0
        public void Test_SetBusinessObject_WhenPropValueNull_ShouldSetTextOnExtendedTextBoxToEmpty()
        {
            //--------------- Set up test pack ------------------
            ExtendedTextBoxMapper mapper             = CreateExtendedLookupComboBoxMapper("Surname");
            ContactPersonTestBO   businessObjectInfo = new ContactPersonTestBO {
                Surname = null
            };

            //--------------- Test Preconditions ----------------
            Assert.IsNull(businessObjectInfo.Surname);
            //--------------- Execute Test ----------------------
            mapper.BusinessObject = businessObjectInfo;
            //--------------- Test Result -----------------------
            Assert.AreSame(businessObjectInfo, mapper.BusinessObject);
            IExtendedTextBox extendedTextBox = (IExtendedTextBox)mapper.Control;

            Assert.AreEqual("", extendedTextBox.Text, "Text on TextBox should be set to EmptyString");
        }
Esempio n. 8
0
        public void Test_SetBusinessObject_ShouldSetTextOnExtendedTextBox()
        {
            //--------------- Set up test pack ------------------
            ExtendedTextBoxMapper mapper             = CreateExtendedLookupComboBoxMapper("Surname");
            ContactPersonTestBO   businessObjectInfo = new ContactPersonTestBO();
            var expectedTextBoxValue = TestUtil.GetRandomString();

            businessObjectInfo.Surname = expectedTextBoxValue;
            //--------------- Test Preconditions ----------------
            Assert.IsNotNullOrEmpty(businessObjectInfo.Surname);
            //--------------- Execute Test ----------------------
            mapper.BusinessObject = businessObjectInfo;
            //--------------- Test Result -----------------------
            Assert.AreSame(businessObjectInfo, mapper.BusinessObject);
            IExtendedTextBox extendedTextBox = (IExtendedTextBox)mapper.Control;

            Assert.AreEqual(expectedTextBoxValue, extendedTextBox.Text, "Text should be set on TextBox");
        }
Esempio n. 9
0
        public void Test_Construct_ReadOnly()
        {
            //--------------- Set up test pack ------------------
            IControlFactory    controlFactory     = GetControlFactory();
            ExtendedTextBoxVWG extendedTextBoxVWG = new ExtendedTextBoxVWG(controlFactory);
            string             propName           = TestUtil.GetRandomString();
            //--------------- Test Preconditions ----------------

            //--------------- Execute Test ----------------------
            ExtendedTextBoxMapper mapper = new ExtendedTextBoxMapper(
                extendedTextBoxVWG, propName, true, controlFactory);

            //--------------- Test Result -----------------------
            Assert.IsInstanceOf(typeof(IControlMapper), mapper);
            Assert.AreEqual(true, mapper.IsReadOnly);
            ExtendedTextBoxMapper lookupComboBoxMapper = mapper;

            Assert.IsNotNull(lookupComboBoxMapper);
            Assert.AreEqual(true, lookupComboBoxMapper.IsReadOnly);
        }