Ejemplo n.º 1
0
        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());
        }
Ejemplo n.º 2
0
        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."));
        }
Ejemplo n.º 3
0
        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."));
        }
Ejemplo n.º 4
0
 public void SetUp()
 {
     _channel = CreateChannel();
 }