public void Test_Constructor() { //---------------Set up test pack------------------- IControlFactory controlFactory = GetControlFactory(); //---------------Execute Test ---------------------- IExtendedTextBox extendedTextBox = controlFactory.CreateExtendedTextBox(); //---------------Test Result ----------------------- ITextBox textBox = extendedTextBox.TextBox; Assert.IsNotNull(textBox); IButton button = extendedTextBox.Button; Assert.IsNotNull(button); Assert.AreEqual("...", button.Text); Assert.IsFalse(textBox.Enabled); if (controlFactory is ControlFactoryWin) { Assert.AreEqual(SystemColors.Window, textBox.BackColor); } else { Assert.AreEqual(Color.White, textBox.BackColor); } Assert.AreEqual(extendedTextBox.Height, textBox.Height); Assert.Greater(button.Left, textBox.Left); }
public ExtendedTextBoxMapperSpy(IExtendedTextBox ctl, string propName, bool isReadOnly, IControlFactory controlFactory) : base(ctl, propName, isReadOnly, controlFactory) { _loadCollectionAfterFormLoad = false; FormClosed = false; }
public void Test_GetButton() { //--------------- Set up test pack ------------------ IControlFactory controlFactory = GetControlFactory(); IExtendedTextBox extendedTextBoxWin = controlFactory.CreateExtendedTextBox(); //--------------- Test Preconditions ---------------- //--------------- Execute Test ---------------------- IButton button = extendedTextBoxWin.Button; //--------------- Test Result ----------------------- Assert.IsNotNull(button); }
public void Test_GetTextBox() { //--------------- Set up test pack ------------------ IControlFactory controlFactory = GetControlFactory(); IExtendedTextBox extendedComboBox = controlFactory.CreateExtendedTextBox(); //--------------- Test Preconditions ---------------- //--------------- Execute Test ---------------------- ITextBox comboBox = extendedComboBox.TextBox; //--------------- Test Result ----------------------- Assert.IsNotNull(comboBox); }
///<summary> /// Constructs the mapper for <see cref="IExtendedComboBox"/>. ///</summary> public ExtendedTextBoxMapper (IExtendedTextBox ctl, string propName, bool isReadOnly, IControlFactory controlFactory) : base(ctl, propName, isReadOnly, controlFactory) { this._loadCollectionAfterFormLoad = true; this.EnableEditing = true; ExtendedTextBox = ctl; ExtendedTextBox.ControlMapper = this; ExtendedTextBox.Button.Click += delegate { SetupPopupForm(); PopupForm.Closing += HandlePopUpFormClosedEvent; PopupForm.ShowDialog(); }; }
///<summary> /// Constructs the mapper for <see cref="IExtendedComboBox"/>. ///</summary> public ExtendedTextBoxMapper (IExtendedTextBox ctl, string propName, bool isReadOnly, IControlFactory controlFactory) : base(ctl, propName, isReadOnly, controlFactory) { this._loadCollectionAfterFormLoad = true; this.EnableEditing = true; ExtendedTextBox = ctl; ExtendedTextBox.ControlMapper = this; ExtendedTextBox.Button.Click += delegate { SetupPopupForm(); PopupForm.Closing += HandlePopUpFormClosedEvent; PopupForm.ShowDialog(); }; }
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"); }
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"); }
public ExtendedTextBoxMapperSpy(IExtendedTextBox ctl, string propName, bool isReadOnly, IControlFactory controlFactory) : base(ctl, propName, isReadOnly, controlFactory) { FormClosed = false; this._loadCollectionAfterFormLoad = false; }
public ExtendedTextBoxMapperReadOnly(IExtendedTextBox ctl, string propName, bool isReadOnly, IControlFactory controlFactory) : base(ctl, propName, isReadOnly, controlFactory) { this.EnableEditing = false; }
public ExtendedTextBoxMapperReadOnly(IExtendedTextBox ctl, string propName, bool isReadOnly, IControlFactory controlFactory) : base(ctl, propName, isReadOnly, controlFactory) { this.EnableEditing = false; }