public void FormatApplyStyle_EnabledWhenCurrentSelection()
        {
            SelectionHelper mockedSelectionHelper = MockRepository.GenerateMock <SelectionHelper>();
            IVwSelection    mockedSelection       = MockRepository.GenerateMock <IVwSelection>();

            mockedSelection.Expect(sel => sel.IsEditable).Return(true);
            mockedSelection.Stub(sel => sel.CanFormatChar).Return(true);
            mockedSelection.Stub(sel => sel.CanFormatPara).Return(true);
            mockedSelectionHelper.Expect(sh => sh.Selection).Return(mockedSelection);
            m_mainWnd.m_mockedEditingHelper.Expect(ed => ed.CurrentSelection).Return(mockedSelectionHelper);

            Assert.IsTrue(m_mainWnd.OnUpdateFormatApplyStyle(m_itemProps));
            Assert.IsTrue(m_itemProps.Enabled);
            mockedSelectionHelper.VerifyAllExpectations();
            mockedSelection.VerifyAllExpectations();
            m_mainWnd.m_mockedEditingHelper.VerifyAllExpectations();
        }
Esempio n. 2
0
        public void FormatApplyStyle_EnabledWhenCurrentSelection()
        {
            CheckDisposed();

            this.m_mainWnd.m_fSimulateNoEditingHelper = false;
            DynamicMock mockedSelectionHelper = new DynamicMock(typeof(SelectionHelper));

            m_mainWnd.m_mockedEditingHelper.ExpectAndReturn("CurrentSelection",
                                                            mockedSelectionHelper.MockInstance);
            DynamicMock mockedSelection = new DynamicMock(typeof(IVwSelection));

            mockedSelectionHelper.ExpectAndReturn("Selection", mockedSelection.MockInstance);
            mockedSelection.ExpectAndReturn("IsEditable", true);
            mockedSelection.SetupResult("CanFormatChar", true);
            mockedSelection.SetupResult("CanFormatPara", true);

            Assert.IsTrue(m_mainWnd.OnUpdateFormatApplyStyle(m_itemProps));
            Assert.IsTrue(m_itemProps.Enabled);
        }