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


C# LexSense.GetOrCreateProperty方法代码示例

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


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

示例1: Setup

		public void Setup()
		{
			_entry = new LexEntry();
			_sense = new LexSense();
			_entry.Senses.Add(_sense);
#if GlossMeaning
			this._sense.Gloss["th"] = "sense";
#else
			_sense.Definition["th"] = "sense";
#endif
			MultiText customFieldInSense =
					_sense.GetOrCreateProperty<MultiText>("customFieldInSense");
			customFieldInSense["th"] = "custom";
			_examples = new LexExampleSentence();
			_sense.ExampleSentences.Add(_examples);
			_examples.Sentence["th"] = "example";
			_examples.Translation["en"] = "translation";
			MultiText customFieldInExample =
					_examples.GetOrCreateProperty<MultiText>("customFieldInExample");
			customFieldInExample["th"] = "custom";
			_entry.EmptyObjectsRemoved += _entry_EmptyObjectsRemoved;
			_entry.PropertyChanged += _entry_PropertyChanged;
			_removed = false;
		}
开发者ID:bbriggs,项目名称:wesay,代码行数:24,代码来源:LexEntryTests.cs

示例2: CustomOptionRefCollectionOnSense

		public void CustomOptionRefCollectionOnSense()
		{
			_fieldToOptionListName.Add("flubs", "colors");
			LexSense sense = new LexSense();
			OptionRefCollection o = sense.GetOrCreateProperty<OptionRefCollection>("flubs");
			o.AddRange(new string[] {"orange", "blue"});
			_exporter.Add(sense);
			_exporter.End();
			Assert.AreEqual(
					GetSenseElement(sense) +
					"<trait name=\"flubs\" value=\"orange\" /><trait name=\"flubs\" value=\"blue\" /></sense>",
					_stringBuilder.ToString());
		}
开发者ID:bbriggs,项目名称:wesay,代码行数:13,代码来源:LiftExportTests.cs

示例3: NoteOnSense_OutputAsNote

		public void NoteOnSense_OutputAsNote()
		{
			using (var session = new LiftExportAsFragmentTestSession())
			{
				LexSense sense = new LexSense();
				MultiText m =
					sense.GetOrCreateProperty<MultiText>(PalasoDataObject.WellKnownProperties.Note);
				m["zz"] = "orange";
				session.LiftWriter.Add(sense);
				session.LiftWriter.End();
				AssertHasAtLeastOneMatch("sense/note/form[@lang='zz' and text='orange']", session);
				AssertHasAtLeastOneMatch("sense[not(field)]", session);
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:14,代码来源:LiftWriterTests.cs

示例4: Picture_OutputAsPictureWithCaption

		public void Picture_OutputAsPictureWithCaption()
		{
			LexSense sense = new LexSense();
			PictureRef p = sense.GetOrCreateProperty<PictureRef>("Picture");
			p.Value = "bird.jpg";
			p.Caption = new MultiText();
			p.Caption["aa"] = "aCaption";
			_exporter.Add(sense);
			_exporter.End();
			CheckAnswer(GetSenseElement(sense) +
						"<illustration href=\"bird.jpg\"><label><form lang=\"aa\"><text>aCaption</text></form></label></illustration></sense>");
		}
开发者ID:bbriggs,项目名称:wesay,代码行数:12,代码来源:LiftExportTests.cs

示例5: NoteOnSense_OutputAsNote

		public void NoteOnSense_OutputAsNote()
		{
			LexSense sense = new LexSense();
			MultiText m =
					sense.GetOrCreateProperty<MultiText>(WeSayDataObject.WellKnownProperties.Note);
			m["zz"] = "orange";
			_exporter.Add(sense);
			_exporter.End();
			AssertXPathNotNull("sense/note/form[@lang='zz' and text='orange']");
			AssertXPathNotNull("sense[not(field)]");
		}
开发者ID:bbriggs,项目名称:wesay,代码行数:11,代码来源:LiftExportTests.cs

示例6: Grammi

		public void Grammi()
		{
			LexSense sense = new LexSense();
			OptionRef o =
					sense.GetOrCreateProperty<OptionRef>(LexSense.WellKnownProperties.PartOfSpeech);
			o.Value = "orange";
			_exporter.Add(sense);
			_exporter.End();
			AssertXPathNotNull("sense/grammatical-info[@value='orange']");
			AssertXPathNotNull("sense[not(trait)]");
		}
开发者ID:bbriggs,项目名称:wesay,代码行数:11,代码来源:LiftExportTests.cs

示例7: EmptyCustomOptionRefCollection

		public void EmptyCustomOptionRefCollection()
		{
			LexSense sense = new LexSense();
			sense.GetOrCreateProperty<OptionRefCollection>("flubadub");
			_exporter.Add(sense);
			_exporter.End();
			AssertXPathNotNull("sense[not(trait)]");
		}
开发者ID:bbriggs,项目名称:wesay,代码行数:8,代码来源:LiftExportTests.cs

示例8: DefinitionOnSense_OutputAsDefinition

		public void DefinitionOnSense_OutputAsDefinition()
		{
			LexSense sense = new LexSense();
			MultiText m =
					sense.GetOrCreateProperty<MultiText>(LexSense.WellKnownProperties.Definition);
			m["zz"] = "orange";
			_exporter.Add(sense);
			_exporter.End();
			AssertXPathNotNull("sense/definition/form[@lang='zz']/text[text()='orange']");
			AssertXPathNotNull("sense[not(field)]");
		}
开发者ID:bbriggs,项目名称:wesay,代码行数:11,代码来源:LiftExportTests.cs

示例9: CustomOptionRefOnSenseWithGrammi

		public void CustomOptionRefOnSenseWithGrammi()
		{
			using (var session = new LiftExportAsFragmentTestSession())
			{
				//_fieldToOptionListName.Add("flub", "kindsOfFlubs");
				var sense = new LexSense();
				var grammi = sense.GetOrCreateProperty<OptionRef>(
					LexSense.WellKnownProperties.PartOfSpeech
				);
				grammi.Value = "verb";

				var o = sense.GetOrCreateProperty<OptionRef>("flub");
				o.Value = "orange";
				session.LiftWriter.Add(sense);
				session.LiftWriter.End();
				AssertHasAtLeastOneMatch("sense/trait[@name='flub' and @value='orange']", session);
				AssertHasAtLeastOneMatch("sense[count(trait)=1]", session);
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:19,代码来源:LiftWriterTests.cs

示例10: CustomOptionRefOnSense

		public void CustomOptionRefOnSense()
		{
			using (var session = new LiftExportAsFragmentTestSession())
			{
				//_fieldToOptionListName.Add("flub", "kindsOfFlubs");
				var sense = new LexSense();
				var o = sense.GetOrCreateProperty<OptionRef>("flub");
				o.Value = "orange";
				session.LiftWriter.Add(sense);
				session.LiftWriter.End();
				string expected = CanonicalXml.ToCanonicalStringFragment(
					GetSenseElement(sense) + "<trait name=\"flub\" value=\"orange\" /></sense>"
				);
				Assert.AreEqual(
					expected,
					session.StringBuilder.ToString()
				);
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:19,代码来源:LiftWriterTests.cs

示例11: CustomMultiTextOnSense

		public void CustomMultiTextOnSense()
		{
			using (var session = new LiftExportAsFragmentTestSession())
			{
				var sense = new LexSense();
				var m = sense.GetOrCreateProperty<MultiText>("flubadub");
				m["zz"] = "orange";
				session.LiftWriter.Add(sense);
				session.LiftWriter.End();
				AssertHasAtLeastOneMatch("sense/field[@type='flubadub']/form[@lang='zz' and text='orange']", session);
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:12,代码来源:LiftWriterTests.cs

示例12: BlankGrammi

		public void BlankGrammi()
		{
			var sense = new LexSense();
			var o = sense.GetOrCreateProperty<OptionRef>(
				LexSense.WellKnownProperties.PartOfSpeech
			);
			o.Value = string.Empty;
			using (var session = new LiftExportAsFragmentTestSession())
			{
				session.LiftWriter.Add(sense);
				session.LiftWriter.End();
				AssertHasAtLeastOneMatch("sense[not(grammatical-info)]", session);
				AssertHasAtLeastOneMatch("sense[not(trait)]", session);
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:15,代码来源:LiftWriterTests.cs

示例13: Picture_OutputAsPictureWithCaption

		public void Picture_OutputAsPictureWithCaption()
		{
			using (var session = new LiftExportAsFragmentTestSession())
			{
				LexSense sense = new LexSense();
				PictureRef p = sense.GetOrCreateProperty<PictureRef>("Picture");
				p.Value = "bird.jpg";
				p.Caption = new MultiText();
				p.Caption["aa"] = "aCaption";
				session.LiftWriter.Add(sense);
				session.LiftWriter.End();
				AssertEqualsCanonicalString(
					GetSenseElement(sense) +
						"<illustration href=\"bird.jpg\"><label><form lang=\"aa\"><text>aCaption</text></form></label></illustration></sense>",
					session
				);
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:18,代码来源:LiftWriterTests.cs

示例14: Picture_OutputAsPictureURLRef

		public void Picture_OutputAsPictureURLRef()
		{
			using (var session = new LiftExportAsFragmentTestSession())
			{
				LexSense sense = new LexSense();
				PictureRef p = sense.GetOrCreateProperty<PictureRef>("Picture");
				p.Value = "bird.jpg";
				session.LiftWriter.Add(sense);
				session.LiftWriter.End();
				AssertEqualsCanonicalString(GetSenseElement(sense) + "<illustration href=\"bird.jpg\" /></sense>", session);
			}
		}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:12,代码来源:LiftWriterTests.cs

示例15: CustomOptionRefOnSense

		public void CustomOptionRefOnSense()
		{
			_fieldToOptionListName.Add("flub", "kindsOfFlubs");
			LexSense sense = new LexSense();
			OptionRef o = sense.GetOrCreateProperty<OptionRef>("flub");
			o.Value = "orange";
			_exporter.Add(sense);
			_exporter.End();
			Assert.AreEqual(
					GetSenseElement(sense) + "<trait name=\"flub\" value=\"orange\" /></sense>",
					_stringBuilder.ToString());
		}
开发者ID:bbriggs,项目名称:wesay,代码行数:12,代码来源:LiftExportTests.cs


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