public void DdlCustomerSelectedIndexChanged_ZeroSelectedIndex_DisablePreview() { // Arrange _channel = CreateChannelWithEmptyPreviewParameters(); InitializeDropDownCustomerControls(ZeroSelectedIndex, NonEmptyText, true, BorderStyle.Dashed); ReflectionHelper.SetField(_channel, FieldLandingPageAssign, new LandingPageAssign() { LPAID = LandingPageID }); // Act var parameters = new object[] { null, EventArgs.Empty }; ReflectionHelper.ExecuteMethod(_channel, DdlCustomerSelectedIndexChangedMethodName, parameters); // Assert var previewButton = ReflectionHelper.GetFieldInfoFromInstanceByName(_channel, HtmlPreviewShowButtonName).GetValue(_channel) as Button; previewButton.ShouldSatisfyAllConditions( () => previewButton.ShouldNotBeNull(), () => previewButton.Enabled.ShouldBeFalse(), () => previewButton.Visible.ShouldBeFalse()); var urlWarning = ReflectionHelper.GetFieldInfoFromInstanceByName(_channel, UrlWarningLabelName).GetValue(_channel) as Label; urlWarning.ShouldSatisfyAllConditions( () => urlWarning.ShouldNotBeNull(), () => urlWarning.BorderStyle.ShouldBe(BorderStyle.None), () => urlWarning.Text.ShouldBeEmpty()); }
public void PageLoad_NotChannelAdministrator_ShowNoAccessPanelAndDisplayError() { // Arrange _channel = CreateChannel(false); InitializePageLoadControls(false, true, false); // Act var parameters = new object[] { null, EventArgs.Empty }; ReflectionHelper.ExecuteMethod(_channel, PageLoadMethodName, parameters); // Assert var previewButton = ReflectionHelper.GetFieldInfoFromInstanceByName(_channel, PreviewButtonName) .GetValue(_channel) as Button; previewButton.ShouldSatisfyAllConditions( () => previewButton.ShouldNotBeNull(), () => previewButton.Enabled.ShouldBeFalse(), () => previewButton.Visible.ShouldBeFalse()); AssertPanelVisibility(NoAccessPanelName, true); AssertPanelVisibility(SettingsPanelName, false); var errorLabel = ReflectionHelper.GetFieldInfoFromInstanceByName(_channel, Label1Name) .GetValue(_channel) as Label; errorLabel.ShouldSatisfyAllConditions( () => errorLabel.ShouldNotBeNull(), () => errorLabel.Text.ShouldBe("You do not have access to this page because you are not a Basechannel Administrator.")); }
public void DdlCustomerSelectedIndexChanged_NullUrl_DisablePreview() { // Arrange _channel = CreateChannelWithEmptyPreviewParameters(); InitializeDropDownCustomerControls(NonZeroSelectedIndex, NonEmptyText, true, BorderStyle.None); ReflectionHelper.SetField(_channel, FieldLandingPageAssign, new LandingPageAssign() { LPAID = LandingPageID }); // Act var parameters = new object[] { null, EventArgs.Empty }; ReflectionHelper.ExecuteMethod(_channel, DdlCustomerSelectedIndexChangedMethodName, parameters); // Assert var previewButton = ReflectionHelper.GetFieldInfoFromInstanceByName(_channel, HtmlPreviewShowButtonName).GetValue(_channel) as Button; previewButton.ShouldSatisfyAllConditions( () => previewButton.ShouldNotBeNull(), () => previewButton.Enabled.ShouldBeFalse(), () => previewButton.Visible.ShouldBeFalse()); var urlWarning = ReflectionHelper.GetFieldInfoFromInstanceByName(_channel, UrlWarningLabelName).GetValue(_channel) as Label; urlWarning.ShouldSatisfyAllConditions( () => urlWarning.ShouldNotBeNull(), () => urlWarning.BorderColor.ShouldBe(Color.Red), () => urlWarning.BorderStyle.ShouldBe(BorderStyle.Dashed), () => urlWarning.Text.ShouldBe($"Something is wrong with the {CustomerDropDownItem2} forward to friend page. \n Please ensure that the customer has sent blasts to at least one group.")); }
public void SetUp() { _channel = CreateChannel(); }