Пример #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());
            }
        }
Пример #2
0
        public void OnPreRender_SetsButtonImages()
        {
            // Arrange
            var toolCrop = new ToolCrop();

            toolCrop.Page         = _shimPage;
            toolCrop.ImageURL     = string.Empty;
            toolCrop.OverImageURL = string.Empty;

            _imageEditor.Toolbar.Tools.Add(toolCrop);

            var toolCropPrivateObject = new MsUnitTesting.PrivateObject(toolCrop);

            // Act
            toolCropPrivateObject.Invoke("OnPreRender", EventArgs.Empty);

            // Assert
            TestsHelper.AssertNotFX1(ToolImageResourceName, toolCrop.ImageURL);
            TestsHelper.AssertNotFX1(ToolOverImageResourceName, toolCrop.OverImageURL);

            TestsHelper.AssertFX1(ToolImageName, toolCrop.ImageURL);
            TestsHelper.AssertFX1(ToolOverImageName, toolCrop.OverImageURL);
        }