Inheritance: InterlinDocForAnalysis
Exemplo n.º 1
0
        public override void TestSetup()
        {
            base.TestSetup();

            m_interlinDoc = new MockInterlinDocForAnalyis(m_stText0);
            m_focusBox    = m_interlinDoc.FocusBox as TestableFocusBox;
        }
		public override void TestSetup()
		{
			base.TestSetup();

			m_interlinDoc = new MockInterlinDocForAnalyis(m_stText0);
			m_focusBox = m_interlinDoc.FocusBox as TestableFocusBox;
		}
        public void SandBoxWithGlossConfig_LoadsGuessForGlossFromAnalysis()
        {
            var mockRb = MockRepository.GenerateMock <IVwRootBox>();

            mockRb.Expect(rb => rb.DataAccess).Return(Cache.MainCacheAccessor);
            var textFactory   = Cache.ServiceLocator.GetInstance <ITextFactory>();
            var stTextFactory = Cache.ServiceLocator.GetInstance <IStTextFactory>();

            text = textFactory.Create();
            var stText1 = stTextFactory.Create();

            text.ContentsOA = stText1;
            var para1 = stText1.AddNewTextPara(null);

            (text.ContentsOA[0]).Contents = TsStringUtils.MakeTss("xxxa xxxa xxxa.", Cache.DefaultVernWs);
            InterlinMaster.LoadParagraphAnnotationsAndGenerateEntryGuessesIfNeeded(stText1, true);
            using (var mockInterlinDocForAnalyis = new MockInterlinDocForAnalyis(stText1)
            {
                MockedRootBox = mockRb
            })
            {
                m_sandbox.SetInterlinDocForTest(mockInterlinDocForAnalyis);

                var cba0_0 = AddWordsToLexiconTests.GetNewAnalysisOccurence(text, 0, 0, 0);
                var wf     = Cache.ServiceLocator.GetInstance <IWfiWordformFactory>().Create(TsStringUtils.MakeTss("xxxa", Cache.DefaultVernWs));
                cba0_0.Analysis = Cache.ServiceLocator.GetInstance <IWfiAnalysisFactory>().Create(wf, Cache.ServiceLocator.GetInstance <IWfiGlossFactory>());
                var gloss    = cba0_0.Analysis.Analysis.MeaningsOC.First();
                var glossTss = TsStringUtils.MakeTss("I did it", Cache.DefaultAnalWs);
                gloss.Form.set_String(Cache.DefaultAnalWs, glossTss);
                m_sandbox.SwitchWord(cba0_0);
                // Verify that the wordgloss was loaded into the m_sandbox
                Assert.AreNotEqual(0, m_sandbox.WordGlossHvo, "The gloss was not set to Default gloss from the analysis.");
                Assert.AreEqual(m_sandbox.WordGlossHvo, gloss.Hvo, "The gloss was not set to Default gloss from the analysis.");
            }
        }