public void UserPromptForSectionHeadWithEmptyPara() { // Set up section head with an empty paragraph IScrSection section = AddSectionToMockedBook(m_book); IStTxtPara para = AddSectionHeadParaToSection(section, "", ScrStyleNames.SectionHead); Options.ShowEmptyParagraphPromptsSetting = true; int defVernWs = Cache.DefaultVernWs; DummyTeStVc stVc = new DummyTeStVc(Cache, defVernWs); CreateExpectedUserPrompt(stVc, para.Hvo, ScrSectionTags.kflidHeading, StTxtParaTags.kflidContents); bool fTextAdded = stVc.CallInsertUserPrompt(m_vwenvMock, para); Assert.IsTrue(fTextAdded, "User prompt not added"); ITsString text = stVc.DisplayVariant(m_vwenvMock, SimpleRootSite.kTagUserPrompt, ScrSectionTags.kflidHeading); string difference; bool fEqual = TsStringHelper.TsStringsAreEqual( ExpectedUserPrompt("Type section head here", defVernWs), text, out difference); Assert.IsTrue(fEqual, difference); m_vwenvMock.VerifyAllExpectations(); }
public void UserPromptForSectionHeadWithEmptyPara() { CheckDisposed(); // Set up section head with an empty paragraph IScrSection section = m_inMemoryCache.AddSectionToMockedBook(m_book.Hvo); StTxtPara para = m_inMemoryCache.AddSectionHeadParaToSection(section.Hvo, "", ScrStyleNames.SectionHead); section.AdjustReferences(); Options.ShowEmptyParagraphPromptsSetting = true; DummyTeStVc stVc = new DummyTeStVc(m_inMemoryCache.Cache, m_inMemoryCache.Cache.DefaultVernWs); CreateExpectedUserPrompt(stVc, para.Hvo, (int)ScrSection.ScrSectionTags.kflidHeading, (int)StTxtPara.StTxtParaTags.kflidContents); IVwEnv vwEnv = (IVwEnv)m_vwenvMock.MockInstance; bool fTextAdded = stVc.CallInsertUserPrompt(vwEnv, para.Hvo); Assert.IsTrue(fTextAdded, "User prompt not added"); ITsString text = stVc.DisplayVariant(vwEnv, SimpleRootSite.kTagUserPrompt, null, (int)ScrSection.ScrSectionTags.kflidHeading); string difference; bool fEqual = TsStringHelper.TsStringsAreEqual( ExpectedUserPrompt("Type section head here", m_inMemoryCache.Cache.DefaultVernWs), text, out difference); Assert.IsTrue(fEqual, difference); m_vwenvMock.Verify(); }
public void UserPromptForBookTitleWithEmptyPara() { // Set up title with an empty paragraph IStText title = AddTitleToMockedBook(m_book, string.Empty, Cache.DefaultVernWs); Options.ShowEmptyParagraphPromptsSetting = true; int defVernWs = Cache.DefaultVernWs; DummyTeStVc stVc = new DummyTeStVc(Cache, defVernWs); CreateExpectedUserPrompt(stVc, title.ParagraphsOS[0].Hvo, ScrBookTags.kflidTitle, StTxtParaTags.kflidContents); m_vwenvMock.Stub(x => x.CurrentObject()).Return(title.ParagraphsOS[0].Hvo); bool fTextAdded = stVc.CallInsertUserPrompt(m_vwenvMock, title[0]); Assert.IsTrue(fTextAdded, "User prompt not added"); ITsString text = stVc.DisplayVariant(m_vwenvMock, SimpleRootSite.kTagUserPrompt, ScrBookTags.kflidTitle); string difference; bool fEqual = TsStringHelper.TsStringsAreEqual( ExpectedUserPrompt("Type book title for Philemon here", defVernWs), text, out difference); Assert.IsTrue(fEqual, difference); m_vwenvMock.VerifyAllExpectations(); }
public void UserPromptForBookTitleWithEmptyPara() { CheckDisposed(); // Set up title with an empty paragraph StText title = m_inMemoryCache.AddTitleToMockedBook(m_book.Hvo, m_emptyTsString, StyleUtils.ParaStyleTextProps(ScrStyleNames.MainBookTitle)); Options.ShowEmptyParagraphPromptsSetting = true; DummyTeStVc stVc = new DummyTeStVc(m_inMemoryCache.Cache, m_inMemoryCache.Cache.DefaultVernWs); CreateExpectedUserPrompt(stVc, title.ParagraphsOS.FirstItem.Hvo, (int)ScrBook.ScrBookTags.kflidTitle, (int)StTxtPara.StTxtParaTags.kflidContents); m_vwenvMock.ExpectAndReturn("CurrentObject", title.ParagraphsOS.FirstItem.Hvo); IVwEnv vwEnv = (IVwEnv)m_vwenvMock.MockInstance; bool fTextAdded = stVc.CallInsertUserPrompt(vwEnv, title.ParagraphsOS.FirstItem.Hvo); Assert.IsTrue(fTextAdded, "User prompt not added"); ITsString text = stVc.DisplayVariant(vwEnv, SimpleRootSite.kTagUserPrompt, null, (int)ScrBook.ScrBookTags.kflidTitle); string difference; bool fEqual = TsStringHelper.TsStringsAreEqual( ExpectedUserPrompt("Type book title for Philemon here", m_inMemoryCache.Cache.DefaultVernWs), text, out difference); Assert.IsTrue(fEqual, difference); m_vwenvMock.Verify(); }
public void UserPromptForSectionHeadWithEmptyPara_NoOption() { // Set up section head with an empty paragraph IScrSection section = AddSectionToMockedBook(m_book); IStTxtPara para = AddSectionHeadParaToSection(section, "", ScrStyleNames.SectionHead); Options.ShowEmptyParagraphPromptsSetting = false; DummyTeStVc stVc = new DummyTeStVc(Cache, Cache.DefaultVernWs); bool fTextAdded = stVc.CallInsertUserPrompt(m_vwenvMock, para); Assert.IsFalse(fTextAdded, "User prompt added"); m_vwenvMock.VerifyAllExpectations(); }
public void NoUserPromptForContentPara() { // Set up empty content paragraph IScrSection section = AddSectionToMockedBook(m_book); IStTxtPara para = AddParaToMockedSectionContent(section, ScrStyleNames.NormalParagraph); DummyTeStVc stVc = new DummyTeStVc(Cache, Cache.DefaultVernWs); bool fTextAdded = stVc.CallInsertUserPrompt(m_vwenvMock, para); Assert.IsFalse(fTextAdded, "User prompt was added to empty content para"); m_vwenvMock.AssertWasNotCalled(x => x.NoteDependency(Arg <int[]> .Is.Anything, Arg <int[]> .Is.Anything, Arg <int> .Is.Anything)); m_vwenvMock.AssertWasNotCalled(x => x.AddProp(Arg <int> .Is.Anything, Arg <IVwViewConstructor> .Is.Anything, Arg <int> .Is.Anything)); m_vwenvMock.VerifyAllExpectations(); }
public void UserPromptForSectionHeadWithEmptyPara_NoOption() { CheckDisposed(); // Set up section head with an empty paragraph IScrSection section = m_inMemoryCache.AddSectionToMockedBook(m_book.Hvo); StTxtPara para = m_inMemoryCache.AddSectionHeadParaToSection(section.Hvo, "", ScrStyleNames.SectionHead); section.AdjustReferences(); Options.ShowEmptyParagraphPromptsSetting = false; DummyTeStVc stVc = new DummyTeStVc(m_inMemoryCache.Cache, m_inMemoryCache.Cache.DefaultVernWs); IVwEnv vwEnv = (IVwEnv)m_vwenvMock.MockInstance; bool fTextAdded = stVc.CallInsertUserPrompt(vwEnv, para.Hvo); Assert.IsFalse(fTextAdded, "User prompt added"); m_vwenvMock.Verify(); }
public void NoUserPromptForContentPara() { CheckDisposed(); // Set up empty content paragraph IScrSection section = m_inMemoryCache.AddSectionToMockedBook(m_book.Hvo); StTxtPara para = m_inMemoryCache.AddParaToMockedSectionContent(section.Hvo, ScrStyleNames.NormalParagraph); section.AdjustReferences(); m_vwenvMock.ExpectNoCall("NoteDependency", new string[] { typeof(int[]).FullName, typeof(int[]).FullName, typeInt }); m_vwenvMock.ExpectNoCall("AddProp", new string[] { typeInt, typeof(IVwViewConstructor).FullName, typeInt }); DummyTeStVc stVc = new DummyTeStVc(m_inMemoryCache.Cache, m_inMemoryCache.Cache.DefaultVernWs); bool fTextAdded = stVc.CallInsertUserPrompt((IVwEnv)m_vwenvMock.MockInstance, para.Hvo); Assert.IsFalse(fTextAdded, "User prompt was added to empty content para"); m_vwenvMock.Verify(); }
public void NoUserPromptForContentPara() { // Set up empty content paragraph IScrSection section = AddSectionToMockedBook(m_book); IStTxtPara para = AddParaToMockedSectionContent(section, ScrStyleNames.NormalParagraph); DummyTeStVc stVc = new DummyTeStVc(Cache, Cache.DefaultVernWs); bool fTextAdded = stVc.CallInsertUserPrompt(m_vwenvMock, para); Assert.IsFalse(fTextAdded, "User prompt was added to empty content para"); m_vwenvMock.AssertWasNotCalled(x => x.NoteDependency(Arg<int[]>.Is.Anything, Arg<int[]>.Is.Anything, Arg<int>.Is.Anything)); m_vwenvMock.AssertWasNotCalled(x => x.AddProp(Arg<int>.Is.Anything, Arg<IVwViewConstructor>.Is.Anything, Arg<int>.Is.Anything)); m_vwenvMock.VerifyAllExpectations(); }