예제 #1
0
        [Test] public void StubbedMethodsCanBeCalledByOtherMethodsWithinObject()
        {
            DynamicMock mock = new DynamicMock(typeof(SameClass));

            mock.Ignore("A");
            mock.Ignore("c");
            SameClass sc = (SameClass)mock.MockInstance;

            mock.SetupResult("b", "hello");

            Assertion.AssertEquals("hello", sc.A());
        }
예제 #2
0
        public void ReuseGeneratedAssembly()
        {
            DynamicMock mock = new DynamicMock(typeof(SameClass));

            mock.Ignore("A");
            mock.Ignore("c");
            SameClass sc = (SameClass)mock.MockInstance;

            mock.SetupResult("b", "hello");
            Assertion.AssertEquals("hello", sc.A());

            mock = new DynamicMock(typeof(SameClass));
            mock.Ignore("A");
            sc = (SameClass)mock.MockInstance;

            mock.ExpectAndReturn("c", true);
            mock.SetupResult("b", "hello");

            AssertEquals("Should have overriden B()", "hello", sc.A());
            mock.Verify();
        }
예제 #3
0
        [Test] public void CanSetStubsAndExpectationsOnMethodsInTheSameClass()
        {
            DynamicMock mock = new DynamicMock(typeof(SameClass));

            mock.Ignore("A");
            SameClass sc = (SameClass)mock.MockInstance;

            mock.ExpectAndReturn("c", true);
            mock.SetupResult("b", "hello");

            AssertEquals("Should have overriden B()", "hello", sc.A());

            mock.Verify();
        }
예제 #4
0
		public void ReuseGeneratedAssembly()
		{
			DynamicMock mock = new DynamicMock(typeof(SameClass));
			mock.Ignore("A");
			mock.Ignore("c");
			SameClass sc = (SameClass)mock.MockInstance;

			mock.SetupResult("b", "hello");
			Assertion.AssertEquals("hello", sc.A());

			mock = new DynamicMock(typeof(SameClass));
			mock.Ignore("A");
			sc = (SameClass)mock.MockInstance;

			mock.ExpectAndReturn("c", true);
			mock.SetupResult("b", "hello");

			AssertEquals("Should have overriden B()", "hello", sc.A());
			mock.Verify();
		}
예제 #5
0
		[Test] public void CanSetStubsAndExpectationsOnMethodsInTheSameClass()
		{
			DynamicMock mock = new DynamicMock(typeof(SameClass));
			mock.Ignore("A");
			SameClass sc = (SameClass)mock.MockInstance;

			mock.ExpectAndReturn("c", true);
			mock.SetupResult("b", "hello");

			AssertEquals("Should have overriden B()", "hello", sc.A());

			mock.Verify();
		}
예제 #6
0
		[Test] public void StubbedMethodsCanBeCalledByOtherMethodsWithinObject()
		{
			DynamicMock mock = new DynamicMock(typeof(SameClass));
			mock.Ignore("A");
			mock.Ignore("c");
			SameClass sc = (SameClass)mock.MockInstance;

			mock.SetupResult("b", "hello");

			Assertion.AssertEquals("hello", sc.A());
		}
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Setup the mock rootbox
		/// </summary>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		private IVwRootBox SetupRootBox()
		{
			m_rootBox = new DynamicMock(typeof(IVwRootBox));
			m_rootBox.SetupResult("SetSite", null, typeof(IVwRootSite));
			m_rootBox.SetupResult("DataAccess", Cache.DomainDataByFlid);
			m_rootBox.SetupResult("SetRootObject", null, typeof(int), typeof(IVwViewConstructor),
				typeof(int), typeof(IVwStylesheet));
			m_rootBox.SetupResult("Height", 200); // JT: arbitrary values.
			m_rootBox.SetupResult("Width", 200);
			m_rootBox.SetupResult("Site", m_btView);
			m_rootBox.Ignore("Close");
			m_rootBox.Ignore("FlashInsertionPoint");
			m_rootBox.SetupResult("GetRootObject", null,
				new string[] { typeof(int).FullName + "&", typeof(IVwViewConstructor).FullName + "&", typeof(int).FullName + "&", typeof(IVwStylesheet).FullName + "&" },
				new object[] { 0, null, 0, null });

			return (IVwRootBox)m_rootBox.MockInstance;
		}
예제 #8
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </summary>
		/// <param name="bookStart"></param>
		/// <param name="iBookStart"></param>
		/// <param name="sectionStart"></param>
		/// <param name="iSecStart"></param>
		/// <param name="paraStart"></param>
		/// <param name="iParaStart"></param>
		/// <param name="ichStart"></param>
		/// <param name="setupForHeadingStart"></param>
		/// <param name="bookEnd"></param>
		/// <param name="iBookEnd"></param>
		/// <param name="sectionEnd"></param>
		/// <param name="iSecEnd"></param>
		/// <param name="paraEnd"></param>
		/// <param name="iParaEnd"></param>
		/// <param name="ichEnd"></param>
		/// <param name="setupForHeadingEnd"></param>
		/// ------------------------------------------------------------------------------------
		public void SetupRangeSelection(IScrBook bookStart, int iBookStart, IScrSection sectionStart,
			int iSecStart, IStTxtPara paraStart, int iParaStart, int ichStart,
			bool setupForHeadingStart, IScrBook bookEnd, int iBookEnd, IScrSection sectionEnd,
			int iSecEnd, IStTxtPara paraEnd, int iParaEnd, int ichEnd, bool setupForHeadingEnd)
		{
			CheckDisposed();

			DynamicMock fakeSelHelper = new DynamicMock(typeof(SelectionHelper));
			fakeSelHelper.SetupResult("NumberOfLevels", 4);
			// Setup the anchor
			SelLevInfo[] topInfo = new SelLevInfo[4];
			topInfo[0].tag = StTextTags.kflidParagraphs;
			topInfo[0].ihvo = iParaStart;
			topInfo[0].hvo = paraStart.Hvo;
			topInfo[1].tag = setupForHeadingStart ? ScrSectionTags.kflidHeading :
				ScrSectionTags.kflidContent;
			topInfo[1].ihvo = 0;
			topInfo[1].hvo = setupForHeadingStart ? sectionStart.HeadingOA.Hvo :
				sectionStart.ContentOA.Hvo;
			topInfo[2].tag = ScrBookTags.kflidSections;
			topInfo[2].ihvo = iSecStart;
			topInfo[2].hvo = sectionStart.Hvo;
			topInfo[3].tag = ScriptureTags.kflidScriptureBooks;
			topInfo[3].ihvo = iBookStart;
			topInfo[3].hvo = bookStart.Hvo;

			// Setup the end
			SelLevInfo[] bottomInfo = new SelLevInfo[4];
			bottomInfo[0].tag = StTextTags.kflidParagraphs;
			bottomInfo[0].ihvo = iParaEnd;
			bottomInfo[0].hvo = paraEnd.Hvo;
			bottomInfo[1].tag = setupForHeadingEnd ? ScrSectionTags.kflidHeading :
				ScrSectionTags.kflidContent;
			bottomInfo[1].ihvo = 0;
			bottomInfo[1].hvo = setupForHeadingEnd ? sectionEnd.HeadingOA.Hvo :
				sectionEnd.ContentOA.Hvo;
			bottomInfo[2].tag = ScrBookTags.kflidSections;
			bottomInfo[2].ihvo = iSecEnd;
			bottomInfo[2].hvo = sectionEnd.Hvo;
			bottomInfo[3].tag = ScriptureTags.kflidScriptureBooks;
			bottomInfo[3].ihvo = iBookEnd;
			bottomInfo[3].hvo = bookEnd.Hvo;

			fakeSelHelper.SetupResult("LevelInfo", topInfo);
			fakeSelHelper.SetupResult("IchAnchor", ichStart);
			fakeSelHelper.SetupResult("IchEnd", ichEnd);
			fakeSelHelper.SetupResult("IsValid", true);
			fakeSelHelper.SetupResult("AssocPrev", false);
			fakeSelHelper.Ignore("get_IsRange");
			fakeSelHelper.SetupResultForParams("GetLevelInfo", topInfo,
				SelectionHelper.SelLimitType.Top);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", topInfo,
				SelectionHelper.SelLimitType.Anchor);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", bottomInfo,
				SelectionHelper.SelLimitType.Bottom);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", bottomInfo,
				SelectionHelper.SelLimitType.End);
			fakeSelHelper.SetupResultForParams("GetIch", ichStart,
				SelectionHelper.SelLimitType.Top);
			fakeSelHelper.SetupResultForParams("GetIch", ichEnd,
				SelectionHelper.SelLimitType.Bottom);
			m_currentSelection = (SelectionHelper)fakeSelHelper.MockInstance;
		}
예제 #9
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Sets up a range selection in the specified back translation.
		/// </summary>
		/// <param name="wsStart">The writing system of the BT where the selection is to start,
		/// or -1 to start in the vernacular.</param>
		/// <param name="wsEnd">The writing system of the BT where the selection is to end,
		/// or -1 to end in the vernacular.</param>
		/// <param name="bookStart">The starting book.</param>
		/// <param name="iBookStart">The index of the starting book.</param>
		/// <param name="sectionStart">The starting section.</param>
		/// <param name="iSecStart">The index of the starting section.</param>
		/// <param name="paraStart">The starting paragraph.</param>
		/// <param name="iParaStart">The index of the starting paragraph.</param>
		/// <param name="ichStart">The starting character offset.</param>
		/// <param name="setupForHeadingStart">if set to <c>true</c> setup selection to start in
		/// section heading; otherwise, set up selection in contents.</param>
		/// <param name="bookEnd">The ending book.</param>
		/// <param name="iBookEnd">The index of the ending book.</param>
		/// <param name="sectionEnd">The ending section.</param>
		/// <param name="iSecEnd">The index of the ending section.</param>
		/// <param name="paraEnd">The ending paragraph.</param>
		/// <param name="iParaEnd">The index of the para end.</param>
		/// <param name="ichEnd">The ending character offset.</param>
		/// <param name="setupForHeadingEnd">if set to <c>true</c> setup selection to end in
		/// section heading; otherwise, set up selection in contents.</param>
		/// ------------------------------------------------------------------------------------
		public void SetupRangeSelection(int wsStart, int wsEnd, IScrBook bookStart, int iBookStart,
			IScrSection sectionStart, int iSecStart, IStTxtPara paraStart, int iParaStart, int ichStart,
			bool setupForHeadingStart, IScrBook bookEnd, int iBookEnd, IScrSection sectionEnd,
			int iSecEnd, IStTxtPara paraEnd, int iParaEnd, int ichEnd, bool setupForHeadingEnd)
		{
			CheckDisposed();

			DynamicMock fakeSelHelper = new DynamicMock(typeof(SelectionHelper));
			int cLevelsTop = wsStart > 0 ? 5 : 4;
			// Setup the anchor
			SelLevInfo[] topInfo = new SelLevInfo[cLevelsTop];
			int iLev = 0;
			if (wsStart > 0)
			{
				topInfo[iLev].tag = -1;
				topInfo[iLev].ihvo = 0;
				topInfo[iLev].hvo = paraStart.TranslationsOC.HvoArray[0];
				iLev++;
			}
			topInfo[iLev].tag = (int)StText.StTextTags.kflidParagraphs;
			topInfo[iLev].ihvo = iParaStart;
			topInfo[iLev].hvo = paraStart.Hvo;
			topInfo[++iLev].tag = setupForHeadingStart ? (int)ScrSection.ScrSectionTags.kflidHeading :
				(int)ScrSection.ScrSectionTags.kflidContent;
			topInfo[iLev].ihvo = 0;
			topInfo[iLev].hvo = setupForHeadingStart ? sectionStart.HeadingOA.Hvo :
				sectionStart.ContentOA.Hvo;
			topInfo[++iLev].tag = (int)ScrBook.ScrBookTags.kflidSections;
			topInfo[iLev].ihvo = iSecStart;
			topInfo[iLev].hvo = sectionStart.Hvo;
			topInfo[++iLev].tag = BookFilter.Tag;
			topInfo[iLev].ihvo = iBookStart;
			topInfo[iLev].hvo = bookStart.Hvo;

			// Setup the end
			int cLevelsBottom = wsEnd > 0 ? 5 : 4;
			SelLevInfo[] bottomInfo = new SelLevInfo[cLevelsBottom];
			iLev = 0;
			if (wsEnd > 0)
			{
				bottomInfo[iLev].tag = -1;
				bottomInfo[iLev].ihvo = 0;
				bottomInfo[iLev].hvo = paraEnd.TranslationsOC.HvoArray[0];
				iLev++;
			}
			bottomInfo[iLev].tag = (int)StText.StTextTags.kflidParagraphs;
			bottomInfo[iLev].ihvo = iParaEnd;
			bottomInfo[iLev].hvo = paraEnd.Hvo;
			bottomInfo[++iLev].tag = setupForHeadingEnd ? (int)ScrSection.ScrSectionTags.kflidHeading :
				(int)ScrSection.ScrSectionTags.kflidContent;
			bottomInfo[iLev].ihvo = 0;
			bottomInfo[iLev].hvo = setupForHeadingEnd ? sectionEnd.HeadingOA.Hvo :
				sectionEnd.ContentOA.Hvo;
			bottomInfo[++iLev].tag = (int)ScrBook.ScrBookTags.kflidSections;
			bottomInfo[iLev].ihvo = iSecEnd;
			bottomInfo[iLev].hvo = sectionEnd.Hvo;
			bottomInfo[++iLev].tag = BookFilter.Tag;
			bottomInfo[iLev].ihvo = iBookEnd;
			bottomInfo[iLev].hvo = bookEnd.Hvo;

			fakeSelHelper.SetupResult("NumberOfLevels", cLevelsTop);
			fakeSelHelper.SetupResultForParams("GetNumberOfLevels", cLevelsTop,
				SelectionHelper.SelLimitType.Top);
			fakeSelHelper.SetupResultForParams("GetNumberOfLevels", cLevelsTop,
				SelectionHelper.SelLimitType.Anchor);
			fakeSelHelper.SetupResultForParams("GetNumberOfLevels", cLevelsBottom,
				SelectionHelper.SelLimitType.Bottom);
			fakeSelHelper.SetupResultForParams("GetNumberOfLevels", cLevelsBottom,
				SelectionHelper.SelLimitType.End);
			fakeSelHelper.SetupResult("LevelInfo", topInfo);
			fakeSelHelper.SetupResult("IchAnchor", ichStart);
			fakeSelHelper.SetupResult("IchEnd", ichEnd);
			fakeSelHelper.SetupResult("Ws", wsStart);
			fakeSelHelper.SetupResult("IsValid", true);
			fakeSelHelper.SetupResult("AssocPrev", false);
			fakeSelHelper.Ignore("get_IsRange");
			fakeSelHelper.SetupResultForParams("GetLevelInfo", topInfo,
				SelectionHelper.SelLimitType.Top);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", topInfo,
				SelectionHelper.SelLimitType.Anchor);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", bottomInfo,
				SelectionHelper.SelLimitType.Bottom);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", bottomInfo,
				SelectionHelper.SelLimitType.End);
			fakeSelHelper.SetupResultForParams("GetTextPropId", wsStart > 0 ?
				(int)CmTranslation.CmTranslationTags.kflidTranslation :
				(int)StTxtPara.StTxtParaTags.kflidContents,
				SelectionHelper.SelLimitType.Top);
			fakeSelHelper.SetupResultForParams("GetTextPropId", wsStart > 0 ?
				(int)CmTranslation.CmTranslationTags.kflidTranslation :
				(int)StTxtPara.StTxtParaTags.kflidContents,
				SelectionHelper.SelLimitType.Anchor);
			fakeSelHelper.SetupResultForParams("GetTextPropId", wsEnd > 0 ?
				(int)CmTranslation.CmTranslationTags.kflidTranslation :
				(int)StTxtPara.StTxtParaTags.kflidContents,
				SelectionHelper.SelLimitType.Bottom);
			fakeSelHelper.SetupResultForParams("GetTextPropId", wsEnd > 0 ?
				(int)CmTranslation.CmTranslationTags.kflidTranslation :
				(int)StTxtPara.StTxtParaTags.kflidContents,
				SelectionHelper.SelLimitType.End);
			fakeSelHelper.SetupResultForParams("GetIch", ichStart,
				SelectionHelper.SelLimitType.Top);
			fakeSelHelper.SetupResultForParams("GetIch", ichStart,
				SelectionHelper.SelLimitType.Anchor);
			fakeSelHelper.SetupResultForParams("GetIch", ichEnd,
				SelectionHelper.SelLimitType.Bottom);
			fakeSelHelper.SetupResultForParams("GetIch", ichEnd,
				SelectionHelper.SelLimitType.End);
			fakeSelHelper.SetupResultForParams("GetWritingSystem", wsStart == -1 ? m_cache.DefaultVernWs : wsStart,
				SelectionHelper.SelLimitType.Top);
			fakeSelHelper.SetupResultForParams("GetWritingSystem", wsStart == -1 ? m_cache.DefaultVernWs : wsStart,
				SelectionHelper.SelLimitType.Anchor);
			fakeSelHelper.SetupResultForParams("GetWritingSystem", wsEnd == -1 ? m_cache.DefaultVernWs : wsEnd,
				SelectionHelper.SelLimitType.Bottom);
			fakeSelHelper.SetupResultForParams("GetWritingSystem", wsEnd == -1 ? m_cache.DefaultVernWs : wsEnd,
				SelectionHelper.SelLimitType.End);
			m_viewSelection = (SelectionHelper)fakeSelHelper.MockInstance;
		}
예제 #10
0
		public void PressingEnterWithPictureSelected_InScrSectionContents()
		{
			CheckDisposed();

			int hvoPic = CreateAndInsertPicture();
			CmPicture pic = new CmPicture(Cache, hvoPic);
			pic.Caption.SetVernacularDefaultWritingSystem("My Caption");

			// Get the first paragraph in the first section of the first book.
			IScrBook book = m_scrInMemoryCache.AddBookToMockedScripture(1, "Genesis");
			IScrSection section = m_scrInMemoryCache.AddSectionToMockedBook(book.Hvo);
			StTxtPara para = m_scrInMemoryCache.AddParaToMockedSectionContent(section.Hvo,
				ScrStyleNames.NormalParagraph);
			m_scrInMemoryCache.AddRunToMockedPara(para, "This is the paragraph", null);
			section.AdjustReferences();

			SelectionHelper helper = PutPictureInParagraph(hvoPic, para);
			helper.IchAnchor = 4;
			helper.SetTextPropId(SelectionHelper.SelLimitType.Anchor, (int)CmPicture.CmPictureTags.kflidCaption);
			ReflectionHelper.SetField(m_editingHelper, "m_viewSelection", helper);

			DynamicMock rootbox = new DynamicMock(typeof(IVwRootBox));
			rootbox.Ignore("Close");
			rootbox.Strict = true;
			ReflectionHelper.SetField(m_RootSite, "m_rootb", rootbox.MockInstance);
			ReflectionHelper.CallMethod(m_editingHelper, "HandleEnterKey", true, string.Empty,
				0, 0, VwShiftStatus.kfssNone, null, Keys.None);
			rootbox.Verify();
		}
예제 #11
0
		public void UserPromptChangeWSWhenPasting()
		{
			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;
			DynamicMock rootb = new DynamicMock(typeof(IVwRootBox));
			rootb.SetupResult("IsCompositionInProgress", false);
			DynamicMock vwsel = new DynamicMock(typeof(IVwSelection));
			IVwRootBox mockRootbox = (IVwRootBox)rootb.MockInstance;
			vwsel.SetupResult("RootBox", mockRootbox);
			vwsel.SetupResult("CLevels", 4, typeof(bool));
			vwsel.Ignore("AllTextSelInfo");
#if DEBUG
			vwsel.SetupResult("IsValid", true);
#endif

			DummyTeStVc stVc = new DummyTeStVc(m_inMemoryCache.Cache,
				m_inMemoryCache.Cache.DefaultAnalWs, mockRootbox);

			// set up the text to paste - will be TE2ST with vernacular WS
			int ws = m_inMemoryCache.Cache.DefaultVernWs;
			ITsPropsFactory propFact = TsPropsFactoryClass.Create();
			ITsTextProps ttp = propFact.MakeProps(null, ws, 0);
			ITsStrBldr bldr = TsStrBldrClass.Create();
			bldr.ReplaceRgch(0, 0, "TEST", 4, ttp);
			ttp = propFact.MakeProps(ScrStyleNames.VerseNumber, ws, 0);
			bldr.ReplaceRgch(2, 2, "2", 1, ttp);
			ITsString tssVal = bldr.GetString();

			// Now simulate the user pasting over the user prompt
			stVc.UpdateProp((IVwSelection)vwsel.MockInstance, para.Hvo,
				SimpleRootSite.kTagUserPrompt, 0, tssVal);

			// verify that the text is in the paragraph, that there is no longer a user
			// prompt, and that the ws changed but the character formatting survives.
			bldr = tssVal.GetBldr();
			bldr.SetIntPropValues(0, 5, (int)FwTextPropType.ktptWs,
				(int)FwTextPropVar.ktpvDefault, m_inMemoryCache.Cache.DefaultAnalWs);
			AssertEx.AreTsStringsEqual(bldr.GetString(), para.Contents.UnderlyingTsString);

			m_vwenvMock.Verify();
		}
예제 #12
0
		public void UserPromptChangeWSWhenTyping()
		{
			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;
			DynamicMock rootb = new DynamicMock(typeof(IVwRootBox));
			rootb.SetupResult("IsCompositionInProgress", false);
			DynamicMock vwsel = new DynamicMock(typeof(IVwSelection));
			IVwRootBox mockRootbox = (IVwRootBox)rootb.MockInstance;
			vwsel.SetupResult("RootBox", mockRootbox);
			vwsel.SetupResult("CLevels", 4, typeof(bool));
			vwsel.Ignore("AllTextSelInfo");
#if DEBUG
			vwsel.SetupResult("IsValid", true);
#endif

			DummyTeStVc stVc = new DummyTeStVc(m_inMemoryCache.Cache, m_inMemoryCache.Cache.DefaultAnalWs, mockRootbox);
			ITsStrFactory tsf = TsStrFactoryClass.Create();
			ITsString tssVal;
			tssVal = tsf.MakeString("TEST", m_inMemoryCache.Cache.DefaultVernWs);

			// Now simulate the user typing over the user prompt
			stVc.UpdateProp((IVwSelection)vwsel.MockInstance, para.Hvo, SimpleRootSite.kTagUserPrompt, 0, tssVal);

			// verify that the text is in the paragraph and that there is no longer a user prompt.
			ITsPropsBldr ttpBldr = TsPropsBldrClass.Create();
			ttpBldr.SetIntPropValues((int)FwTextPropType.ktptWs,
				(int)FwTextPropVar.ktpvDefault, m_inMemoryCache.Cache.DefaultAnalWs);
			ITsStrBldr bldr = TsStrBldrClass.Create();
			bldr.Replace(0, 0, "TEST", ttpBldr.GetTextProps());
			string diff;
			Assert.IsTrue(TsStringHelper.TsStringsAreEqual(bldr.GetString(),
				para.Contents.UnderlyingTsString, out diff), diff);

			m_vwenvMock.Verify();
		}
예제 #13
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes an ActionHandler mock object
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public virtual void InitializeActionHandler()
		{
			CheckDisposed();
			m_acth = new DynamicMock(typeof(IActionHandler));
			m_acth.SetupResult("CurrentDepth", 0); // TODO: update our action handler depth to be 1.
			m_acth.SetupResult("IsUndoOrRedoInProgress", false);
			m_acth.SetupResult("CanUndo", false);
			m_acth.SetupResult("Mark", 432);
			m_acth.Ignore("AddAction");

			((NewFdoCache)m_fdoCache).ActionHandler = (IActionHandler)m_acth.MockInstance;
		}
예제 #14
0
		public void Setup()
		{
			CheckDisposed();
			m_ode = new DynamicMock(typeof(IOleDbEncap));
			m_odde = new DynamicMock(typeof(IVwOleDbDa));
			m_mdc = new DynamicMock(typeof(IFwMetaDataCache));
			m_odc = new DynamicMock(typeof(IOleDbCommand));
			m_odc.Ignore("ExecCommand");
			m_ode.SetupResult("CreateCommand", null,
				new string[] { "SIL.FieldWorks.Common.COMInterfaces.IOleDbCommand&"},
				new object[] { m_odc.MockInstance });

			m_cacheBase = new CacheBase((IFwMetaDataCache)m_mdc.MockInstance);

			if (m_fdoCache != null)
				m_fdoCache.Dispose();
			m_fdoCache = new DummyFdoCache((IOleDbEncap)m_ode.MockInstance,
				(IFwMetaDataCache)m_mdc.MockInstance, (IVwOleDbDa)m_odde.MockInstance,
				m_cacheBase);
		}