示例#1
0
        public void Init_InitPopupContents_SetsPopupContentsValues(bool isEmptyId)
        {
            // Arrange
            var usePopupOnClickSet = true;

            ShimToolButton.AllInstances.UsePopupOnClickSetBoolean = (obj, value) => usePopupOnClickSet = value;
            Editor.indexTools = 0;

            // Act
            using (var testObject = new ToolSpellChecker(isEmptyId ? string.Empty : TestValue))
            {
                // Assert
                testObject.ShouldSatisfyAllConditions(
                    () => testObject.ID.ShouldBe(isEmptyId ? ToolSpellCheckerIdText : TestValue),
                    () => testObject.PopupContents.ID.ShouldBe(isEmptyId ? $"{ToolSpellCheckerIdText}{nameof(Popup)}" : $"{TestValue}{nameof(Popup)}"),
                    () => TestsHelper.AssertNotFX1(string.Empty, testObject.ImageURL),
                    () => TestsHelper.AssertNotFX1(string.Empty, testObject.OverImageURL),
                    () => TestsHelper.AssertFX1(SpellOffImage, testObject.ImageURL),
                    () => TestsHelper.AssertFX1(SpellOverImage, testObject.OverImageURL),
                    () => testObject.ToolTip.ShouldBe(TitleText),
                    () => usePopupOnClickSet.ShouldBeFalse(),
                    () => testObject.PopupContents.Height.ShouldBe(105),
                    () => testObject.PopupContents.Width.ShouldBe(305),
                    () => testObject.PopupContents.TitleText.ShouldBe(TitleText),
                    () => testObject.PopupContents.AutoContent.ShouldBeTrue(),
                    () => testObject.PopupContents.ShowShadow.ShouldBeFalse());
            }
        }
        public void Apply_EditorWithDifferentTools_SetsCorrectPopupContentTitleText()
        {
            // Arrange
            var toolbar          = _editor.Toolbars.Toolbars[0];
            var toolSpellChecker = new ToolSpellChecker();

            toolbar.Tools.Add(toolSpellChecker);
            var toolFind = new ToolFind();

            toolbar.Tools.Add(toolFind);
            var toolReplace = new ToolReplace();

            toolbar.Tools.Add(toolReplace);
            var toolImage = new ToolImage();

            toolbar.Tools.Add(toolImage);
            var toolLink = new ToolLink();

            toolbar.Tools.Add(toolLink);
            var toolFlash = new ToolFlash();

            toolbar.Tools.Add(toolFlash);

            // Arrange & Act
            LocalizationHelper.Apply(_localizationSettings, _editor);

            // Assert
            _editor.ShouldSatisfyAllConditions(
                () => _editor.ShouldNotBeNull(),
                () => toolSpellChecker.PopupContents.TitleText.ShouldBe(LocalizedTextId.TOOL_SPELL_CHECKER_TITLE),
                () => toolFind.PopupContents.TitleText.ShouldBe(LocalizedTextId.TOOL_FIND_TITLE),
                () => toolReplace.PopupContents.TitleText.ShouldBe(LocalizedTextId.TOOL_REPLACE_TITLE),
                () => toolImage.PopupContents.TitleText.ShouldBe(LocalizedTextId.TOOL_IMAGE_TITLE),
                () => toolLink.PopupContents.TitleText.ShouldBe(LocalizedTextId.TOOL_LINK_TITLE),
                () => toolFlash.PopupContents.TitleText.ShouldBe(LocalizedTextId.TOOL_FLASH_TITLE));
        }