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


C# LiftExportAsFragmentTestSession.OutputString方法代码示例

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


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

示例1: Entry_EntryHasIdWithInvalidXMLCharacters_CharactersEscaped

		public void Entry_EntryHasIdWithInvalidXMLCharacters_CharactersEscaped()
		{
			const string expected = "id=\"<>&"'\"";
			using (var session = new LiftExportAsFragmentTestSession())
			{
				var entry = session.CreateItem();
				// technically the only invalid characters in an attribute are & < and " (when surrounded by ")
				entry.Id = "<>&\"\'";
				//_lexEntryRepository.SaveItem(entry);
				session.LiftWriter.Add(entry);
				string result = session.OutputString();
				Assert.IsTrue(result.Contains(expected));
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:14,代码来源:LiftWriterTests.cs

示例2: ExampleSentenceWithTranslation

		public void ExampleSentenceWithTranslation()
		{
			using (var session = new LiftExportAsFragmentTestSession())
			{
				var example = new LexExampleSentence();
				example.Sentence["blue"] = "ocean's eleven";
				example.Sentence["red"] = "red sunset tonight";
				example.Translation["green"] = "blah blah";
				session.LiftWriter.Add(example);
				var outPut = session.OutputString();
				AssertEqualsCanonicalString(
					"<example><form lang=\"blue\"><text>ocean's eleven</text></form><form lang=\"red\"><text>red sunset tonight</text></form><translation><form lang=\"green\"><text>blah blah</text></form></translation></example>", outPut);
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:14,代码来源:LiftWriterTests.cs

示例3: BlankExample

		public void BlankExample()
		{
			using (var session = new LiftExportAsFragmentTestSession())
			{
				session.LiftWriter.Add(new LexExampleSentence());
				AssertEqualsCanonicalString("<example />", session.OutputString());
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:8,代码来源:LiftWriterTests.cs

示例4: BlankSense

		public void BlankSense()
		{
			using (var session = new LiftExportAsFragmentTestSession())
			{
				var sense = new LexSense();
				session.LiftWriter.Add(sense);
				AssertEqualsCanonicalString(
					String.Format("<sense id=\"{0}\" />", sense.GetOrCreateId()),
					session.OutputString()
				);
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:12,代码来源:LiftWriterTests.cs

示例5: Add_MultiTextWithMalFormedXML_IsExportedText

		public void Add_MultiTextWithMalFormedXML_IsExportedText()
		{
			const string expected =
				"<form\r\n\tlang=\"de\">\r\n\t<text>This &lt;span href=\"reference\"&gt;is not well formed&lt;span&gt; XML!</text>\r\n</form>";
			using (var session = new LiftExportAsFragmentTestSession())
			{
				var multiText = new MultiText();
				multiText.SetAlternative("de", "This <span href=\"reference\">is not well formed<span> XML!");
				session.LiftWriter.AddMultitextForms(null, multiText);
				session.LiftWriter.End();
				Assert.AreEqual(expected, session.OutputString());
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:13,代码来源:LiftWriterTests.cs

示例6: Add_TextWithSpanAndMeaningfulWhiteSpace_FormattingAndWhitespaceIsUntouched

		public void Add_TextWithSpanAndMeaningfulWhiteSpace_FormattingAndWhitespaceIsUntouched()
		{
			const string formattedText = "\rThis's <span href=\"reference\">\n is a\t\t\n\r\t span</span> with annoying whitespace!\r\n";
			const string expected = "<form\r\n\tlang=\"de\">\r\n\t<text>" + formattedText + "</text>\r\n</form>";
			using (var session = new LiftExportAsFragmentTestSession())
			{
				var multiText = new MultiText();
				multiText.SetAlternative("de", formattedText);
				session.LiftWriter.AddMultitextForms(null, multiText);
				session.LiftWriter.End();
				Assert.AreEqual(expected, session.OutputString());
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:13,代码来源:LiftWriterTests.cs

示例7: Add_MalformedXmlWithWithScaryUnicodeChar_IsExportedAsText

		public void Add_MalformedXmlWithWithScaryUnicodeChar_IsExportedAsText()
		{
			const string expected = "<form\r\n\tlang=\"de\">\r\n\t<text>This &lt;span href=\"reference\"&gt;is not well &#x1F; formed&lt;span&gt; XML!</text>\r\n</form>";
			//  1F is the character for "Segment Separator" and you can insert it by right-clicking in windows
			using (var session = new LiftExportAsFragmentTestSession())
			{
				var multiText = new MultiText();
				multiText.SetAlternative("de", "This <span href=\"reference\">is not well \u001F formed<span> XML!");
				session.LiftWriter.AddMultitextForms(null, multiText);
				session.LiftWriter.End();
				Assert.AreEqual(expected, session.OutputString());
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:13,代码来源:LiftWriterTests.cs

示例8: AttributesWithProblematicCharacters

		public void AttributesWithProblematicCharacters()
		{
			const string expected = "lang=\"x&quot;y\">";
			using (var session = new LiftExportAsFragmentTestSession())
			{
				var sense = new LexSense();
				sense.Gloss["x\"y"] = "test";
				session.LiftWriter.Add(sense);
				session.LiftWriter.End();
				string result = session.OutputString();
				Assert.IsTrue(result.Contains(expected));
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:13,代码来源:LiftWriterTests.cs

示例9: Add_MultiTextWithWellFormedXMLAndScaryCharacter_IsExportedAsXML

		public void Add_MultiTextWithWellFormedXMLAndScaryCharacter_IsExportedAsXML()
		{
			const string expected =
			"<form\r\n\tlang=\"de\">\r\n\t<text>This <span href=\"reference\">is well &#x1F; formed</span> XML!</text>\r\n</form>";
			using (var session = new LiftExportAsFragmentTestSession())
			{
				var multiText = new MultiText();
				multiText.SetAlternative("de", "This <span href=\"reference\">is well \u001F formed</span> XML!");
				session.LiftWriter.AddMultitextForms(null, multiText);
				session.LiftWriter.End();
				Assert.AreEqual(expected, session.OutputString());
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:13,代码来源:LiftWriterTests.cs

示例10: Add_MultiTextWithScaryUnicodeChar_IsExported

		public void Add_MultiTextWithScaryUnicodeChar_IsExported()
		{
			const string expected =
				"<form\r\n\tlang=\"de\">\r\n\t<text>This has a segment separator character at the end&#x1F;</text>\r\n</form>";
			//  1F is the character for "Segment Separator" and you can insert it by right-clicking in windows
			using (var session = new LiftExportAsFragmentTestSession())
			{
				var multiText = new MultiText();
				multiText.SetAlternative("de", "This has a segment separator character at the end\u001F");
				session.LiftWriter.AddMultitextForms(null, multiText);
				session.LiftWriter.End();
				Assert.AreEqual(expected, session.OutputString());
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:14,代码来源:LiftWriterTests.cs

示例11: AddRelationTarget_SenseWithSynonymRelations

		public void AddRelationTarget_SenseWithSynonymRelations()
		{
			using (var session = new LiftExportAsFragmentTestSession())
			{
				var sense = new LexSense();
				sense.AddRelationTarget("synonym", "one");
				sense.AddRelationTarget("synonym", "two");
				sense.AddRelationTarget("antonym", "bee");

				session.LiftWriter.Add(sense);
				string result = session.OutputString();
				AssertThatXmlIn.String(result).HasAtLeastOneMatchForXpath(
					"/sense/relation[@type='synonym' and @ref='one']"
				);
				AssertThatXmlIn.String(result).HasAtLeastOneMatchForXpath(
					"/sense/relation[@type='synonym' and @ref='two']"
				);
				AssertThatXmlIn.String(result).HasAtLeastOneMatchForXpath(
					"/sense/relation[@type='antonym' and @ref='bee']"
				);
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:22,代码来源:LiftWriterTests.cs

示例12: SenseWithSynonymRelations

		public void SenseWithSynonymRelations()
		{
			using (var session = new LiftExportAsFragmentTestSession())
			{
				var sense = new LexSense();

				var synonymRelationType = new LexRelationType(
					"synonym",
					LexRelationType.Multiplicities.Many,
					LexRelationType.TargetTypes.Sense
				);

				var antonymRelationType = new LexRelationType(
					"antonym",
					LexRelationType.Multiplicities.Many,
					LexRelationType.TargetTypes.Sense
				);

				var relations = new LexRelationCollection();
				sense.Properties.Add(new KeyValuePair<string, IPalasoDataObjectProperty>("relations", relations));

				relations.Relations.Add(new LexRelation(synonymRelationType.ID, "one", sense));
				relations.Relations.Add(new LexRelation(synonymRelationType.ID, "two", sense));
				relations.Relations.Add(new LexRelation(antonymRelationType.ID, "bee", sense));

				session.LiftWriter.Add(sense);
				string result = session.OutputString();
				AssertThatXmlIn.String(result).HasAtLeastOneMatchForXpath(
					"/sense/relation[@type='synonym' and @ref='one']"
				);
				AssertThatXmlIn.String(result).HasAtLeastOneMatchForXpath(
					"/sense/relation[@type='synonym' and @ref='two']"
				);
				AssertThatXmlIn.String(result).HasAtLeastOneMatchForXpath(
					"/sense/relation[@type='antonym' and @ref='bee']"
				);
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:38,代码来源:LiftWriterTests.cs

示例13: SenseWithExample

		public void SenseWithExample()
		{
			using (var session = new LiftExportAsFragmentTestSession())
			{
				var sense = new LexSense();
				var example = new LexExampleSentence();
				example.Sentence["red"] = "red sunset tonight";
				sense.ExampleSentences.Add(example);
				session.LiftWriter.Add(sense);
				string result = session.OutputString();
				AssertThatXmlIn.String(result).HasAtLeastOneMatchForXpath(
					"/sense/example/form[@lang='red']/text[text()='red sunset tonight']"
				);
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:15,代码来源:LiftWriterTests.cs

示例14: MultiText

		public void MultiText()
		{
			using (var session = new LiftExportAsFragmentTestSession())
			{
				var text = new MultiText();
				text["blue"] = "ocean";
				text["red"] = "sunset";
				session.LiftWriter.AddMultitextForms(null, text);
				AssertEqualsCanonicalString(
					"<form lang=\"blue\"><text>ocean</text></form><form lang=\"red\"><text>sunset</text></form>",
					session.OutputString()
				);
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:14,代码来源:LiftWriterTests.cs

示例15: GlossWithProblematicCharacters

		public void GlossWithProblematicCharacters()
		{
			const string expected = "<text>LessThan&lt;GreaterThan&gt;Ampersan&amp;</text>";
			using (var session = new LiftExportAsFragmentTestSession())
			{
				var sense = new LexSense();
				sense.Gloss["blue"] = "LessThan<GreaterThan>Ampersan&";
				session.LiftWriter.Add(sense);
				string result = session.OutputString();
				Assert.IsTrue(result.Contains(expected));
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:12,代码来源:LiftWriterTests.cs


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