private void AssertVisibleProperties(regBlast regBlast, string[] dropDownNames, bool isVisible) { foreach (var controlName in dropDownNames) { var control = ReflectionHelper.GetFieldInfoFromInstanceByName(regBlast, controlName).GetValue(regBlast) as DropDownList; Assert.That(control, Is.Not.Null); Assert.That(control.Visible, Is.EqualTo(isVisible)); } }
private void SetStyleAttribute(regBlast regBlast, string[] textBoxesNames, string displayAttribute) { var textBox = new TextBox(); textBox.Attributes.Add(StyleAttribute, displayAttribute); foreach (var controlName in TextBoxesNames) { ReflectionHelper.SetValue(regBlast, controlName, textBox); } }
protected override void SetPageSessionContext() { base.SetPageSessionContext(); InitializeSessionFakes(); _testEntity = new regBlast(); _privateTestObject = new PrivateObject(_testEntity); InitializeAllControls(_testEntity); _groupExplorer = (WizardGroup.groupExplorer)_privateTestObject.GetFieldOrProperty(GroupExplorerField); InitializeAllControls(_groupExplorer); _privateGroupExplorerObj = new PrivateObject(_groupExplorer); }
private void AssertStyleAttributes(regBlast regBlast, string[] textBoxesNames, string displayMode) { foreach (var controlName in textBoxesNames) { var control = ReflectionHelper.GetFieldInfoFromInstanceByName(regBlast, controlName).GetValue(regBlast) as TextBox; Assert.That(control, Is.Not.Null); Assert.That(control.Attributes, Is.Not.Null); Assert.That(control.Attributes.Count, Is.EqualTo(1)); Assert.That(control.Attributes[StyleAttribute], Is.EqualTo(displayMode)); } }
private void SetVisibleProperty(regBlast regBlast, string[] dropDownNames, bool isVisible) { var dropDownList = new DropDownList() { Visible = isVisible }; foreach (var controlName in dropDownNames) { ReflectionHelper.SetValue(regBlast, controlName, dropDownList); } }
public void BtnChangeEnvelopeOnclick_InVisibleEmailFromDropDownList_ShowDropDownListsAndHideTextBoxes() { // Arrange HttpContext.Current = MockHelpers.FakeHttpContext(); var regBlast = new regBlast(); ReflectionHelper.SetValue(regBlast, "drpEmailFrom", new DropDownList { Visible = false }); SetVisibleProperty(regBlast, DropDownNames, false); SetStyleAttribute(regBlast, TextBoxesNames, DisplayInline); // Act ReflectionHelper.ExecuteMethod(regBlast, "btnChangeEnvelope_onclick", new object[] { null, null }); // Assert AssertVisibleProperties(regBlast, DropDownNames, true); AssertStyleAttributes(regBlast, TextBoxesNames, DisplayNone); }