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); }
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); }
private static ExtendedTextBoxMapper CreateExtendedLookupComboBoxMapper(string propertyName) { IControlFactory controlFactory = GetControlFactory(); ExtendedTextBoxWin extendedTextBoxWin = new ExtendedTextBoxWin(controlFactory); ExtendedTextBoxMapper mapper = new ExtendedTextBoxMapper( extendedTextBoxWin, propertyName, true, controlFactory); return mapper; }
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); }