Esempio n. 1
0
        public void ExampleSourcePreserved()
        {
            LexExampleSentence ex = new LexExampleSentence();

            _builder.MergeInSource(ex, "fred");

            Assert.AreEqual("fred",
                            ex.GetProperty <OptionRef>(LexExampleSentence.WellKnownProperties.Source)
                            .Value);
        }
Esempio n. 2
0
        public void Add(LexExampleSentence example)
        {
            if (!ShouldOutputProperty(LexExampleSentence.WellKnownProperties.ExampleSentence))
            {
                return;
            }

            List <string> propertiesAlreadyOutput = new List <string>();

            Writer.WriteStartElement("example");

            OptionRef source =
                example.GetProperty <OptionRef>(LexExampleSentence.WellKnownProperties.Source);

            if (source != null && source.Value.Length > 0)
            {
                if (ShouldOutputProperty(LexExampleSentence.WellKnownProperties.Source))
                {
                    Writer.WriteAttributeString("source", source.Value);
                    propertiesAlreadyOutput.Add("source");
                }
            }

            WriteMultiTextNoWrapper(LexExampleSentence.WellKnownProperties.ExampleSentence,
                                    example.Sentence);
            propertiesAlreadyOutput.Add(LexExampleSentence.WellKnownProperties.ExampleSentence);
            //  WriteMultiWithWrapperIfNonEmpty(LexExampleSentence.WellKnownProperties.Translation, "translation", example.Translation);

            if (!MultiTextBase.IsEmpty(example.Translation))
            {
                Writer.WriteStartElement("translation");

                if (!string.IsNullOrEmpty(example.TranslationType))
                {
                    Writer.WriteAttributeString("type", example.TranslationType);
                    propertiesAlreadyOutput.Add("type");
                }

                AddMultitextForms(LexExampleSentence.WellKnownProperties.Translation, example.Translation);
                Writer.WriteEndElement();
                propertiesAlreadyOutput.Add(LexExampleSentence.WellKnownProperties.Translation);
            }

            if (ShouldOutputProperty(LexExampleSentence.WellKnownProperties.ExampleSentence))
            {
                WriteWellKnownCustomMultiText(example,
                                              PalasoDataObject.WellKnownProperties.Note,
                                              propertiesAlreadyOutput);
            }

            WriteCustomProperties(example, propertiesAlreadyOutput);
            Writer.WriteEndElement();
        }
		public void ExampleSourcePreserved()
		{
			LexExampleSentence ex = new LexExampleSentence();
			_builder.MergeInSource(ex, "fred");

			Assert.AreEqual("fred",
							ex.GetProperty<OptionRef>(LexExampleSentence.WellKnownProperties.Source)
									.Value);
		}