当前位置: 首页>>代码示例>>C#>>正文


C# DynamicMock.SetupResultForParams方法代码示例

本文整理汇总了C#中NMock.DynamicMock.SetupResultForParams方法的典型用法代码示例。如果您正苦于以下问题:C# DynamicMock.SetupResultForParams方法的具体用法?C# DynamicMock.SetupResultForParams怎么用?C# DynamicMock.SetupResultForParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NMock.DynamicMock的用法示例。


在下文中一共展示了DynamicMock.SetupResultForParams方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetupSelectionForParas

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates a simulated range selection
		/// </summary>
		/// <param name="hvoPara1"></param>
		/// <param name="hvoPara2"></param>
		/// <param name="ichAnchor"></param>
		/// <param name="ichEnd"></param>
		/// ------------------------------------------------------------------------------------
		public void SetupSelectionForParas(int hvoPara1, int hvoPara2, int ichAnchor, int ichEnd)
		{
			CheckDisposed();

			DynamicMock fakeSelHelper = new DynamicMock(typeof(SelectionHelper));
			fakeSelHelper.SetupResult("NumberOfLevels", 1);
			SelLevInfo[] topInfo = new SelLevInfo[1];
			topInfo[0].tag = StTextTags.kflidParagraphs;
			topInfo[0].hvo = hvoPara1;
			SelLevInfo[] bottomInfo = new SelLevInfo[1];
			bottomInfo[0].tag = StTextTags.kflidParagraphs;
			bottomInfo[0].hvo = hvoPara2;
			fakeSelHelper.SetupResult("LevelInfo", topInfo);
			fakeSelHelper.SetupResult("IchAnchor", ichAnchor);
			fakeSelHelper.SetupResult("IchEnd", ichEnd);
			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", ichAnchor,
				SelectionHelper.SelLimitType.Top);
			fakeSelHelper.SetupResultForParams("GetIch", ichEnd,
				SelectionHelper.SelLimitType.Bottom);
			m_currentSelection = (SelectionHelper)fakeSelHelper.MockInstance;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:38,代码来源:NotesEditingHelperTests.cs

示例2: SetupRangeSelection

		/// ------------------------------------------------------------------------------------
		/// <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);
//.........这里部分代码省略.........
开发者ID:sillsdev,项目名称:WorldPad,代码行数:101,代码来源:TeEditingHelperTests.cs

示例3: DummySCTextEnum

		/// <summary></summary>
		public DummySCTextEnum(IScrImportSet settings, ImportDomain domain,
			BCVRef startRef, BCVRef endRef) :
			base(settings, domain, startRef, endRef)
		{
			DynamicMock mockConverters = new DynamicMock(typeof(IEncConverters));
			mockConverters.SetupResultForParams("Item", new DummyEncConverter(), "UPPERCASE");
			m_encConverters = (IEncConverters)mockConverters.MockInstance;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:9,代码来源:SCTextEnumTests.cs

示例4: SetupInsertVerseSelection

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Sets up expected values for selection and action handler
		/// </summary>
		/// <param name="para">The paragraph.</param>
		/// <param name="section">The section.</param>
		/// <param name="ich">The character offset of the IP in the para.</param>
		/// <returns>Mock selection</returns>
		/// ------------------------------------------------------------------------------------
		private DynamicMock SetupInsertVerseSelection(IStTxtPara para, IScrSection section, int ich)
		{
			int hvoPara = para.Hvo;

#if DEBUG
			m_selHelper.SetupResult("IsRange", false);
#endif
			m_selHelper.SetupResult("IchAnchor", ich);
			m_selHelper.SetupResult("IchEnd", ich);
			m_selHelper.SetupResultForParams("GetIch", ich, new object[] { SelectionHelper.SelLimitType.Anchor });
			m_selHelper.SetupResultForParams("GetIch", ich, new object[] { SelectionHelper.SelLimitType.End });
			m_selHelper.SetupResultForParams("GetIch", ich, new object[] { SelectionHelper.SelLimitType.Top });
			m_selHelper.SetupResultForParams("GetIch", ich, new object[] { SelectionHelper.SelLimitType.Bottom });

			DynamicMock sel = new DynamicMock(typeof(IVwSelection));
			m_rootBox.SetupResult("Selection", sel.MockInstance);
			sel.Strict = true;
			sel.SetupResult("IsValid", true);

			m_selHelper.ExpectAndReturn("ReduceSelectionToIp",
				m_selHelper.MockInstance, SelectionHelper.SelLimitType.Top, false, false);
			m_selHelper.SetupResultForParams("GetTextPropId",
				StTextTags.kflidParagraphs, SelectionHelper.SelLimitType.Anchor);
			m_selHelper.ExpectAndReturn("GetTextPropId", StTxtParaTags.kflidContents,
				new object[] { SelectionHelper.SelLimitType.Top });

			ITsPropsBldr builder = TsPropsBldrClass.Create();
			ITsTextProps selProps = builder.GetTextProps();
			m_selHelper.ExpectAndReturn("SelProps", selProps);
			m_selHelper.ExpectAndReturn("SetSelection", sel.MockInstance, false);
			m_selHelper.Expect("AssocPrev", true);
			m_selHelper.Expect("SetIPAfterUOW");
			m_selHelper.ExpectAndReturn("GetTextPropId", StTxtParaTags.kflidContents,
				new object[] { SelectionHelper.SelLimitType.Top });

			sel.SetupResultForParams("TextSelInfo", null, m_TextSelInfoArgsEnd, m_TextSelInfoTypes,
				new object[] { true, para.Contents, ich,
							 false, para.Hvo, kflidParaContent, 0 });
			sel.SetupResultForParams("TextSelInfo", null, m_TextSelInfoArgsAnchor, m_TextSelInfoTypes,
				new object[] { false, para.Contents, ich,
							 false, para.Hvo, kflidParaContent, 0 });
			m_selHelper.ExpectAndReturn("GetTextPropId", StTxtParaTags.kflidContents,
				new object[] { SelectionHelper.SelLimitType.Top });
			m_selHelper.SetupResultForParams("GetTss", para.Contents,
				new object[] { SelectionHelper.SelLimitType.Anchor });

			SetupSelection(sel, para, section);

			return sel;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:59,代码来源:DraftViewInsertVerseNumberTests.cs

示例5: ParseCharString_BogusCharacter

		//[ExpectedException(typeof(ArgumentException),
		//	ExpectedMessage = "The character \u0301 (U+0301) is not valid\r\nParameter name: chars")]
		public void ParseCharString_BogusCharacter()
		{
			var cpe = new DynamicMock(typeof(ILgCharacterPropertyEngine));
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccMn, 0x0301);
			cpe.SetupResultForParams("get_IsLetter", false, 0x0301);
			cpe.SetupResult("get_IsNumber", false, typeof(int));
			cpe.SetupResult("get_IsPunctuation", false, typeof(int));
			cpe.SetupResult("get_IsSymbol", false, typeof(int));
			cpe.SetupResultForParams("get_IsMark", true, 0x0301);
			List<string> invalidChars;
			var validChars = TsStringUtils.ParseCharString("\u0301", " ",
				(ILgCharacterPropertyEngine)cpe.MockInstance, out invalidChars);
			Assert.AreEqual(0, validChars.Count);
			Assert.AreEqual(1, invalidChars.Count);
			Assert.AreEqual("\u0301", invalidChars[0]);
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:18,代码来源:TsStringUtilsTests.cs

示例6: ParseCharString_LeadingSpace

		public void ParseCharString_LeadingSpace()
		{
			var cpe = new DynamicMock(typeof(ILgCharacterPropertyEngine));
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccLl, (int)'a');
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccLl, (int)'b');
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccZs, (int)' ');
			cpe.SetupResultForParams("get_IsLetter", true, (int)'a');
			cpe.SetupResultForParams("get_IsLetter", true, (int)'b');
			cpe.SetupResultForParams("get_IsLetter", false, (int)' ');
			cpe.SetupResult("get_IsNumber", false, typeof(int));
			cpe.SetupResult("get_IsPunctuation", false, typeof(int));
			cpe.SetupResult("get_IsSymbol", false, typeof(int));
			cpe.SetupResult("get_IsMark", false, typeof(int));
			List<string> invalidChars;
			var validChars = TsStringUtils.ParseCharString("  a b", " ",
				(ILgCharacterPropertyEngine)cpe.MockInstance, out invalidChars);
			Assert.AreEqual(3, validChars.Count);
			Assert.AreEqual(" ", validChars[0]);
			Assert.AreEqual("a", validChars[1]);
			Assert.AreEqual("b", validChars[2]);
			Assert.AreEqual(0, invalidChars.Count);
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:22,代码来源:TsStringUtilsTests.cs

示例7: SetupInsertChapterSelection

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Sets up expected values for selection and action handler
		/// </summary>
		/// <param name="para">The paragraph.</param>
		/// <param name="iPara">The index of the para.</param>
		/// <param name="hvoSection">The hvo of the section.</param>
		/// <param name="iSection">The index of the section.</param>
		/// <param name="hvoBook">The hvo of the book.</param>
		/// <param name="ich">The character offset of the IP in the para.</param>
		/// <returns>Mock selection</returns>
		/// ------------------------------------------------------------------------------------
		private DynamicMock SetupInsertChapterSelection(StTxtPara para, int iPara,
			int hvoSection, int iSection, int hvoBook, int ich)
		{
			int hvoPara = para.Hvo;

			DynamicMock sel = new DynamicMock(typeof(IVwSelection));
			sel.Strict = true;
			sel.SetupResult("IsValid", true);
			sel.SetupResult("SelType", VwSelType.kstText);
			sel.SetupResult("IsRange", false);

			sel.ExpectAndReturn("Commit", true);
			m_rootBox.SetupResult("Selection", sel.MockInstance);

			// set up expected calls to action handler
			m_selHelper.SetupResult("Selection", sel.MockInstance);
			SelLevInfo[] info = new SelLevInfo[4];
			info[0] = new SelLevInfo();
			info[0].tag = (int)StText.StTextTags.kflidParagraphs;
			info[0].hvo = hvoPara;
			info[0].ihvo = iPara;
			info[1] = new SelLevInfo();
			info[1].tag = (int)ScrSection.ScrSectionTags.kflidContent;
			info[1].hvo = Cache.LangProject.Hvo; // hvo of text. Who cares?
			info[2] = new SelLevInfo();
			info[2].tag = (int)ScrBook.ScrBookTags.kflidSections;
			info[2].hvo = hvoSection;
			info[2].ihvo = iSection;
			info[3] = new SelLevInfo();
			info[3].tag = m_draftView.BookFilter.Tag;
			info[3].hvo = hvoBook;
			m_selHelper.SetupResult("GetLevelInfo", info,
				new Type[] { typeof(SelectionHelper.SelLimitType)});
			m_selHelper.SetupResult("LevelInfo", info);
			m_selHelper.SetupResultForParams("GetTextPropId",
				(int)StText.StTextTags.kflidParagraphs, SelectionHelper.SelLimitType.Anchor);

			sel.SetupResultForParams("TextSelInfo", null, m_TextSelInfoArgsEnd, m_TextSelInfoTypes,
				new object[] { true, para.Contents.UnderlyingTsString, ich, false, hvoPara,
					kflidParaContent, 0 });
			sel.SetupResultForParams("TextSelInfo", null, m_TextSelInfoArgsAnchor, m_TextSelInfoTypes,
				new object[] { false, para.Contents.UnderlyingTsString, ich, false, hvoPara,
					kflidParaContent, 0 });
			m_selHelper.ExpectAndReturn("GetTextPropId", (int)StTxtPara.StTxtParaTags.kflidContents, new object[] { SelectionHelper.SelLimitType.Top });
			m_selHelper.SetupResultForParams("GetTss", para.Contents.UnderlyingTsString,
				new object[] { SelectionHelper.SelLimitType.Anchor });
			m_selHelper.SetupResult("IsValid", true);

			return sel;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:62,代码来源:DraftViewInsertChapterNumberTests.cs

示例8: ValidateCharacterSequence_MultipleBaseCharsThatComposeIntoASingleBaseChar

		public void ValidateCharacterSequence_MultipleBaseCharsThatComposeIntoASingleBaseChar()
		{
			var cpe = new DynamicMock(typeof(ILgCharacterPropertyEngine));
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccLo, 0x1100);
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccLo, 0x1161);
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccLo, 0x11B7);
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccLo, 0xAC10);
			cpe.SetupResultForParams("get_IsLetter", true, 0x1100);
			cpe.SetupResultForParams("get_IsLetter", true, 0x1161);
			cpe.SetupResultForParams("get_IsLetter", true, 0x11B7);
			cpe.SetupResultForParams("get_IsLetter", true, 0xAC10);
			cpe.SetupResult("get_IsNumber", false, typeof(int));
			cpe.SetupResult("get_IsPunctuation", false, typeof(int));
			cpe.SetupResult("get_IsSymbol", true, typeof(int));
			cpe.SetupResult("get_IsMark", false, typeof(int));
			Assert.AreEqual("\uAC10",
				TsStringUtils.ValidateCharacterSequence("\u1100\u1161\u11B7",
				(ILgCharacterPropertyEngine)cpe.MockInstance));
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:19,代码来源:TsStringUtilsTests.cs

示例9: IsValidChar_MultipleBaseCharsThatComposeIntoASingleBaseChar

		public void IsValidChar_MultipleBaseCharsThatComposeIntoASingleBaseChar()
		{
			var cpe = new DynamicMock(typeof(ILgCharacterPropertyEngine));
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccLo, 0x1100);
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccLo, 0x1161);
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccLo, 0x11B7);
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccLo, 0xAC10);
			cpe.SetupResultForParams("get_IsLetter", true, 0x1100);
			cpe.SetupResultForParams("get_IsLetter", true, 0x1161);
			cpe.SetupResultForParams("get_IsLetter", true, 0x11B7);
			cpe.SetupResultForParams("get_IsLetter", true, 0xAC10);
			cpe.SetupResult("get_IsNumber", false, typeof(int));
			cpe.SetupResult("get_IsPunctuation", false, typeof(int));
			cpe.SetupResult("get_IsSymbol", true, typeof(int));
			cpe.SetupResult("get_IsMark", false, typeof(int));
			cpe.SetupResultForParams("NormalizeD", "\u1100\u1161\u11B7", "\uAC10");
			cpe.SetupResultForParams("NormalizeD", "\u1100\u1161\u11B7", "\u1100\u1161\u11B7");
			Assert.IsTrue(ReflectionHelper.GetBoolResult(typeof(TsStringUtils), "IsValidChar",
				"\u1100\u1161\u11B7", (ILgCharacterPropertyEngine)cpe.MockInstance));
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:20,代码来源:TsStringUtilsTests.cs

示例10: ValidateCharacterSequence_MultipleLetters

		public void ValidateCharacterSequence_MultipleLetters()
		{
			DynamicMock cpe = new DynamicMock(typeof(ILgCharacterPropertyEngine));
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccLl, (int)'n');
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccLl, (int)'o');
			cpe.SetupResultForParams("get_IsLetter", true, (int)'n');
			cpe.SetupResultForParams("get_IsLetter", true, (int)'o');
			cpe.SetupResult("get_IsNumber", false, typeof(int));
			cpe.SetupResult("get_IsPunctuation", false, typeof(int));
			cpe.SetupResult("get_IsSymbol", false, typeof(int));
			cpe.SetupResult("get_IsMark", false, typeof(int));
			Assert.AreEqual("n", StringUtils.ValidateCharacterSequence("no", null,
				(ILgCharacterPropertyEngine)cpe.MockInstance));
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:14,代码来源:StringUtilsTest.cs

示例11: ValidateCharacterSequence_DiacriticBeforeLetter

		public void ValidateCharacterSequence_DiacriticBeforeLetter()
		{
			var cpe = new DynamicMock(typeof(ILgCharacterPropertyEngine));
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccLl, 0x0301);
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccLl, (int)'o');
			cpe.SetupResultForParams("get_IsLetter", false, 0x0301);
			cpe.SetupResultForParams("get_IsLetter", true, (int)'o');
			cpe.SetupResult("get_IsNumber", false, typeof(int));
			cpe.SetupResult("get_IsPunctuation", false, typeof(int));
			cpe.SetupResult("get_IsSymbol", false, typeof(int));
			cpe.SetupResultForParams("get_IsMark", true, 0x0301);
			cpe.SetupResultForParams("get_IsMark", false, (int)'o');
			Assert.AreEqual("o", TsStringUtils.ValidateCharacterSequence("\u0301o",
				(ILgCharacterPropertyEngine)cpe.MockInstance));
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:15,代码来源:TsStringUtilsTests.cs

示例12: ValidateCharacterSequence_BaseCharacterPlusMultipleDiacritics

		public void ValidateCharacterSequence_BaseCharacterPlusMultipleDiacritics()
		{
			DynamicMock cpe = new DynamicMock(typeof(ILgCharacterPropertyEngine));
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccLl, 0x05E9);
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccMn, 0x05C1);
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccMn, 0x05B4);
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccMn, 0x0596);
			cpe.SetupResultForParams("get_IsLetter", true, 0x05E9);
			cpe.SetupResultForParams("get_IsLetter", false, 0x05C1);
			cpe.SetupResultForParams("get_IsLetter", false, 0x05B4);
			cpe.SetupResultForParams("get_IsLetter", false, 0x0596);
			cpe.SetupResult("get_IsNumber", false, typeof(int));
			cpe.SetupResult("get_IsPunctuation", false, typeof(int));
			cpe.SetupResult("get_IsSymbol", false, typeof(int));
			cpe.SetupResultForParams("get_IsMark", false, 0x05E9);
			cpe.SetupResultForParams("get_IsMark", true, 0x05C1);
			cpe.SetupResultForParams("get_IsMark", true, 0x05B4);
			cpe.SetupResultForParams("get_IsMark", true, 0x0596);
			Assert.AreEqual("\u05E9\u05C1\u05B4\u0596",
				StringUtils.ValidateCharacterSequence("\u05E9\u05C1\u05B4\u0596", null,
				(ILgCharacterPropertyEngine)cpe.MockInstance));
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:22,代码来源:StringUtilsTest.cs

示例13: AddDefaultMappingIfNeeded_btMappingsWithNonDefaultMappings

		public void AddDefaultMappingIfNeeded_btMappingsWithNonDefaultMappings()
		{
			DynamicMock mockStylesheet = new DynamicMock(typeof(IVwStylesheet));
			mockStylesheet.SetupResultForParams("GetContext", (int)ContextValues.General, "Emphasis");
			mockStylesheet.SetupResultForParams("GetType", (int)StyleType.kstCharacter, "Emphasis");

			ScrMappingList list = new ScrMappingList(MappingSet.Main, (IVwStylesheet)mockStylesheet.MockInstance);
			list.Add(new ImportMappingInfo(@"\p", null, "Emphasis"));
			list.AddDefaultMappingIfNeeded(@"\btp", ImportDomain.Main, true);
			Assert.AreEqual(2, list.Count);

			// Test that \btp maps automatically to the corresponding vernacular style ("Emphasis")
			// but does not map into the Back-trans marker domain because Emphasis is a character style.
			ImportMappingInfo info = list[@"\btp"];
			Assert.AreEqual(MarkerDomain.Default, info.Domain, @"\btp should not map automatically as a Back-trans marker");
			Assert.IsFalse(info.IsExcluded);
			Assert.AreEqual(MappingTargetType.TEStyle, info.MappingTarget);
			Assert.AreEqual("Emphasis", info.StyleName);
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:19,代码来源:ScrMappingListTests.cs

示例14: AddDefaultMappingIfNeeded_btMappings

		public void AddDefaultMappingIfNeeded_btMappings()
		{
			DynamicMock mockStylesheet = new DynamicMock(typeof(IVwStylesheet));
			mockStylesheet.SetupResultForParams("GetContext", (int)ContextValues.Note, ScrStyleNames.NormalFootnoteParagraph);
			mockStylesheet.SetupResultForParams("GetContext", (int)ContextValues.Text, ScrStyleNames.NormalParagraph);
			mockStylesheet.SetupResultForParams("GetContext", (int)ContextValues.General, "Emphasis");
			mockStylesheet.SetupResultForParams("GetContext", (int)ContextValues.Annotation, ScrStyleNames.Remark);
			mockStylesheet.SetupResultForParams("GetType", (int)StyleType.kstParagraph, ScrStyleNames.NormalFootnoteParagraph);
			mockStylesheet.SetupResultForParams("GetType", (int)StyleType.kstParagraph, ScrStyleNames.NormalParagraph);
			mockStylesheet.SetupResultForParams("GetType", (int)StyleType.kstCharacter, "Emphasis");
			mockStylesheet.SetupResultForParams("GetType", (int)StyleType.kstParagraph, ScrStyleNames.Remark);

			ScrMappingList list = new ScrMappingList(MappingSet.Main, (IVwStylesheet)mockStylesheet.MockInstance);
			list.AddDefaultMappingIfNeeded(@"\bt", ImportDomain.Main, true);
			list.AddDefaultMappingIfNeeded(@"\btc", ImportDomain.Main, true);
			list.AddDefaultMappingIfNeeded(@"\btf", ImportDomain.Main, true);
			list.AddDefaultMappingIfNeeded(@"\btp", ImportDomain.Main, true);
			list.Add(new ImportMappingInfo(@"\emph", null, "Emphasis"));
			list.AddDefaultMappingIfNeeded(@"\btemph", ImportDomain.Main, true);
			list.AddDefaultMappingIfNeeded(@"\btrem", ImportDomain.Main, true);
			list.AddDefaultMappingIfNeeded(@"\bty", ImportDomain.Main, true);
			Assert.AreEqual(8, list.Count);

			// Test that \bt does not map automatically as a Back-trans marker.
			ImportMappingInfo info = list[@"\bt"];
			Assert.AreEqual(MarkerDomain.Default, info.Domain, @"\bt should not map automatically as a Back-trans marker");
			Assert.IsFalse(info.IsExcluded);
			Assert.AreEqual(MappingTargetType.TEStyle, info.MappingTarget);
			Assert.IsNull(info.StyleName);

			// Test that \btc does not map automatically as a Back-trans marker (this is a special exception to the rul).
			info = list[@"\btc"];
			Assert.AreEqual(MarkerDomain.Default, info.Domain, @"\btc should not map automatically as a Back-trans marker");
			Assert.IsFalse(info.IsExcluded);
			Assert.AreEqual(MappingTargetType.TEStyle, info.MappingTarget);
			Assert.IsNull(info.StyleName);

			// Test that \btf maps automatically as a Back-trans marker.
			info = list[@"\btf"];
			Assert.AreEqual(MarkerDomain.BackTrans | MarkerDomain.Footnote, info.Domain, @"\btf should map automatically as a Back-trans marker");
			Assert.IsFalse(info.IsExcluded);
			Assert.AreEqual(MappingTargetType.TEStyle, info.MappingTarget);
			Assert.AreEqual(ScrStyleNames.NormalFootnoteParagraph, info.StyleName);

			// Test that \btp maps automatically as a Back-trans marker.
			info = list[@"\btp"];
			Assert.AreEqual(MarkerDomain.BackTrans, info.Domain, @"\btp should map automatically as a Back-trans marker");
			Assert.IsFalse(info.IsExcluded);
			Assert.AreEqual(MappingTargetType.TEStyle, info.MappingTarget);
			Assert.AreEqual(ScrStyleNames.NormalParagraph, info.StyleName);

			// Test that \btemph maps automatically to the corresponding vernacular style but does not map
			// into the Back-trans marker domain because \emph is a character style.
			info = list[@"\btemph"];
			Assert.AreEqual(MarkerDomain.Default, info.Domain, @"\btemph should not map automatically as a Back-trans marker");
			Assert.IsFalse(info.IsExcluded);
			Assert.AreEqual(MappingTargetType.TEStyle, info.MappingTarget);
			Assert.AreEqual("Emphasis", info.StyleName);

			// Test that \btrem does not map automatically as a Back-trans marker (because \rem is a Note style).
			info = list[@"\btrem"];
			Assert.AreEqual(MarkerDomain.Default, info.Domain, @"\btrem should not map automatically as a Back-trans marker");
			Assert.IsFalse(info.IsExcluded);
			Assert.AreEqual(MappingTargetType.TEStyle, info.MappingTarget);
			Assert.IsNull(info.StyleName);

			// Test that \bty does not map automatically as a Back-trans marker (because \y has no default mapping).
			info = list[@"\bty"];
			Assert.AreEqual(MarkerDomain.Default, info.Domain, @"\bty should not map automatically as a Back-trans marker");
			Assert.IsFalse(info.IsExcluded);
			Assert.AreEqual(MappingTargetType.TEStyle, info.MappingTarget);
			Assert.IsNull(info.StyleName);
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:73,代码来源:ScrMappingListTests.cs

示例15: SetupRangeSelection

		/// ------------------------------------------------------------------------------------
		/// <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;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:84,代码来源:NotesEditingHelperTests.cs


注:本文中的NMock.DynamicMock.SetupResultForParams方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。