private static LiftMultiText MakeBasicLiftMultiText() { LiftMultiText forms = new LiftMultiText(); forms.Add("ws-one", "uno"); forms.Add("ws-two", "dos"); return forms; }
private static LiftMultiText MakeBasicLiftMultiText(string text) { LiftMultiText forms = new LiftMultiText(); forms.Add("ws-one", text); forms.Add("ws-two", text + "-in-two"); return(forms); }
private static LiftMultiText MakeBasicLiftMultiText() { LiftMultiText forms = new LiftMultiText(); forms.Add("ws-one", "uno"); forms.Add("ws-two", "dos"); return(forms); }
public void NewEntryGetsLexemeForm() { LexEntry e = MakeSimpleEntry(); LiftMultiText forms = new LiftMultiText(); forms.Add("x", "hello"); forms.Add("y", "bye"); _builder.MergeInLexemeForm(e, forms); Assert.AreEqual(2, e.LexicalForm.Count); }
public void EntryWithCitation() { LexEntry entry = MakeSimpleEntry(); LiftMultiText forms = new LiftMultiText(); forms.Add("x", "hello"); forms.Add("y", "bye"); _builder.MergeInCitationForm(entry, forms); MultiText citation = entry.GetProperty <MultiText>(LexEntry.WellKnownProperties.Citation); Assert.AreEqual(2, citation.Forms.Length); Assert.AreEqual("hello", citation["x"]); Assert.AreEqual("bye", citation["y"]); }
public void MultipleGlossesCombined() { LexSense sense = new LexSense(); _builder.MergeInGloss(sense, MakeBasicLiftMultiText()); LiftMultiText secondGloss = new LiftMultiText(); secondGloss.Add("ws-one", "UNO"); secondGloss.Add("ws-three", "tres"); _builder.MergeInGloss(sense, secondGloss); //MultiText mt = sense.GetProperty<MultiText>(LexSense.WellKnownProperties.Note); Assert.AreEqual(3, sense.Gloss.Forms.Length); Assert.AreEqual("uno; UNO", sense.Gloss["ws-one"]); }
public void ExampleTranslations_FreeFollowedByUnmarked() { LexEntry e = MakeSimpleEntry(); LexSense sense = new LexSense(); e.Senses.Add(sense); LexExampleSentence ex = new LexExampleSentence(); sense.ExampleSentences.Add(ex); LiftMultiText t2 = new LiftMultiText(); t2.Add("aa", "freestuff"); _builder.MergeInTranslationForm(ex, "Free translation", t2, "<translation type='free'><bogus/></translation>"); LiftMultiText translation = new LiftMultiText(); translation.Add("aa", "unmarked translation"); _builder.MergeInTranslationForm(ex, "", translation, "<translation><bogusUnmarked/></translation>"); _builder.FinishEntry(e); _liftWriter.Add(e); _liftWriter.End(); AssertHasAtLeastOneMatch("//entry/sense/example/translation[not(@type)]/bogusUnmarked"); AssertHasAtLeastOneMatch( "//entry/sense/example/translation[@type='Free translation']/form/text[text()='freestuff']"); }
public void ExampleTranslations_MultipleTypes() { LexEntry e = MakeSimpleEntry(); LexSense sense = new LexSense(); e.Senses.Add(sense); LexExampleSentence ex = new LexExampleSentence(); sense.ExampleSentences.Add(ex); LiftMultiText translation = new LiftMultiText(); translation.Add("aa", "unmarked translation"); _builder.MergeInTranslationForm(ex, "", translation, "bogus raw xml"); LiftMultiText t2 = new LiftMultiText(); t2.Add("aa", "type2translation"); _builder.MergeInTranslationForm(ex, "type2", t2, "<translation type='type2'><bogus/></translation>"); _builder.FinishEntry(e); _liftWriter.Add(e); _liftWriter.End(); AssertHasAtLeastOneMatch( "//entry/sense/example/translation[not(@type)]/form[@lang='aa']/text[text()='unmarked translation']"); AssertHasAtLeastOneMatch("//entry/sense/example/translation[@type='type2']/bogus"); }
public void EntryGetsLexemeFormWithUnheardOfLanguage() { LexEntry e = MakeSimpleEntry(); LiftMultiText forms = new LiftMultiText(); forms.Add("x99", "hello"); _builder.MergeInLexemeForm(e, forms); Assert.AreEqual("hello", e.LexicalForm["x99"]); }
public void Create_LiftMultiTextWithOutSpansInForms_ReturnsMultiTextWithOutSpansInForms() { LiftString liftStringToConvert = new LiftString("No spans here!"); LiftMultiText liftMultiTextWithSpansInForms = new LiftMultiText(); liftMultiTextWithSpansInForms.Add("de", liftStringToConvert); MultiText multiText = MultiText.Create(liftMultiTextWithSpansInForms); Assert.AreEqual("No spans here!", multiText["de"]); }
public void MergeInTranslationForm_NoType_GetContents() { LexExampleSentence ex = new LexExampleSentence(); LiftMultiText translation = new LiftMultiText(); translation.Add("aa", "aaaa"); _builder.MergeInTranslationForm(ex, "", translation, "bogus raw xml"); Assert.AreEqual("aaaa", ex.Translation["aa"]); Assert.IsTrue(string.IsNullOrEmpty(ex.TranslationType)); }
public void MergeInTranslationForm_UnheardOfType_StillBecomesTranslation() { LexExampleSentence ex = new LexExampleSentence(); LiftMultiText translation = new LiftMultiText(); translation.Add("aa", "aaaa"); _builder.MergeInTranslationForm(ex, "madeUpType", translation, "bogus raw xml"); Assert.AreEqual("aaaa", ex.Translation["aa"]); Assert.AreEqual("madeUpType", ex.TranslationType); }
public void MergeInTranslationForm_TypeFree_GetContentsAndSavesType() { LexExampleSentence ex = new LexExampleSentence(); LiftMultiText translation = new LiftMultiText(); translation.Add("aa", "aaaa"); _builder.MergeInTranslationForm(ex, "Free translation", translation, "bogus raw xml"); Assert.AreEqual("aaaa", ex.Translation["aa"]); Assert.AreEqual("Free translation", ex.TranslationType); }
public void GetFormWithSpans_WritingSystemLinkedToFormWithSpans_ReturnsFormWithSpans() { LiftString liftStringToConvert = new LiftString("Text to Mark Up!"); LiftSpan span1 = new LiftSpan(0, 4, "", "", ""); liftStringToConvert.Spans.Add(span1); LiftMultiText liftMultiTextWithSpansInForms = new LiftMultiText(); liftMultiTextWithSpansInForms.Add("de", liftStringToConvert); MultiText multiText = MultiText.Create(liftMultiTextWithSpansInForms); Assert.AreEqual("<span>Text</span> to Mark Up!", multiText["de"]); }
public void GetFormWithSpans_WritingSystemLinkedToFormWithOutSpans_ReturnsFormWithOutSpans() { LiftString liftStringToConvert = new LiftString("No spans here!"); LiftMultiText liftMultiTextWithSpansInForms = new LiftMultiText(); liftMultiTextWithSpansInForms.Add("de", liftStringToConvert); MultiText multiText = MultiText.Create(liftMultiTextWithSpansInForms); Assert.AreEqual("No spans here!", multiText["de"]); }
public void Create_LiftMultiTextWithSpansInForms_ReturnsMultiTextWithSpansInForms() { LiftString liftStringToConvert = new LiftString("Text to Mark Up!"); LiftSpan span1 = new LiftSpan(0, 4, "", "", ""); liftStringToConvert.Spans.Add(span1); LiftMultiText liftMultiTextWithSpansInForms = new LiftMultiText(); liftMultiTextWithSpansInForms.Add("de", liftStringToConvert); MultiText multiText = MultiText.Create(liftMultiTextWithSpansInForms); Assert.AreEqual("<span>Text</span> to Mark Up!", multiText["de"]); }
public void ExampleTranslation_OneWithNoType() { LexEntry e = MakeSimpleEntry(); LexSense sense = new LexSense(); e.Senses.Add(sense); LexExampleSentence ex = new LexExampleSentence(); sense.ExampleSentences.Add(ex); LiftMultiText translation = new LiftMultiText(); translation.Add("aa", "aaaa"); _builder.MergeInTranslationForm(ex, "", translation, "bogus raw xml"); _builder.FinishEntry(e); _liftWriter.Add(e); _liftWriter.End(); AssertHasAtLeastOneMatch("//entry/sense/example/translation[not(@type)]/form[@lang='aa']"); }
public void MergeInTranslationForm_UnheardOfType_StillBecomesTranslation() { LexExampleSentence ex = new LexExampleSentence(); LiftMultiText translation = new LiftMultiText(); translation.Add("aa", "aaaa"); _builder.MergeInTranslationForm(ex, "madeUpType", translation, "bogus raw xml"); Assert.AreEqual("aaaa", ex.Translation["aa"]); Assert.AreEqual("madeUpType",ex.TranslationType); }
public void EntryWithCitation() { LexEntry entry = MakeSimpleEntry(); LiftMultiText forms = new LiftMultiText(); forms.Add("x", "hello"); forms.Add("y", "bye"); _builder.MergeInCitationForm(entry, forms); MultiText citation = entry.GetProperty<MultiText>(LexEntry.WellKnownProperties.Citation); Assert.AreEqual(2, citation.Forms.Length); Assert.AreEqual("hello", citation["x"]); Assert.AreEqual("bye", citation["y"]); }
private static LiftMultiText MakeBasicLiftMultiText(string text) { LiftMultiText forms = new LiftMultiText(); forms.Add("ws-one", text); forms.Add("ws-two", text+"-in-two"); return forms; }
public void ExampleTranslation_OneWithNoType() { LexEntry e = MakeSimpleEntry(); LexSense sense = new LexSense(); e.Senses.Add(sense); LexExampleSentence ex = new LexExampleSentence(); sense.ExampleSentences.Add(ex); LiftMultiText translation = new LiftMultiText(); translation.Add("aa", "aaaa"); _builder.MergeInTranslationForm(ex, "", translation, "bogus raw xml"); _builder.FinishEntry(e); _exporter.Add(e); _exporter.End(); AssertXPathNotNull("//entry/sense/example/translation[not(@type)]/form[@lang='aa']"); }
public void ExampleTranslations_MultipleTypes() { LexEntry e = MakeSimpleEntry(); LexSense sense = new LexSense(); e.Senses.Add(sense); LexExampleSentence ex = new LexExampleSentence(); sense.ExampleSentences.Add(ex); LiftMultiText translation = new LiftMultiText(); translation.Add("aa", "unmarked translation"); _builder.MergeInTranslationForm(ex, "", translation, "bogus raw xml"); LiftMultiText t2 = new LiftMultiText(); t2.Add("aa", "type2translation"); _builder.MergeInTranslationForm(ex, "type2", t2, "<translation type='type2'><bogus/></translation>"); _builder.FinishEntry(e); _exporter.Add(e); _exporter.End(); AssertXPathNotNull( "//entry/sense/example/translation[not(@type)]/form[@lang='aa']/text[text()='unmarked translation']"); AssertXPathNotNull("//entry/sense/example/translation[@type='type2']/bogus"); }
public void ExampleTranslations_FreeThenUnmarked() { LexEntry e = MakeSimpleEntry(); LexSense sense = new LexSense(); e.Senses.Add(sense); LexExampleSentence ex = new LexExampleSentence(); sense.ExampleSentences.Add(ex); LiftMultiText t2 = new LiftMultiText(); t2.Add("aa", "freestuff"); _builder.MergeInTranslationForm(ex, "free", t2, "<translation type='free'><bogus/></translation>"); LiftMultiText translation = new LiftMultiText(); translation.Add("aa", "unmarked translation"); _builder.MergeInTranslationForm(ex, "", translation, "<translation><bogusUnmarked/></translation>"); _builder.FinishEntry(e); _exporter.Add(e); _exporter.End(); AssertXPathNotNull("//entry/sense/example/translation[not(@type)]/bogusUnmarked"); AssertXPathNotNull( "//entry/sense/example/translation[@type='free']/form/text[text()='freestuff']"); }
public void MultipleNotesCombined() { LexSense sense = new LexSense(); _builder.MergeInNote(sense, null, MakeBasicLiftMultiText()); LiftMultiText secondNote = new LiftMultiText(); secondNote.Add("ws-one", "UNO"); secondNote.Add("ws-three", "tres"); _builder.MergeInNote(sense, null, secondNote); MultiText mt = sense.GetProperty<MultiText>(WeSayDataObject.WellKnownProperties.Note); Assert.AreEqual(3, mt.Forms.Length); Assert.AreEqual("uno || UNO", mt["ws-one"]); }
public void FirstValueOfSimpleMultiText() { LiftMultiText t = new LiftMultiText(); LiftString s1 = new LiftString(); s1.Text = "1"; t.Add("x", s1); LiftString s2 = new LiftString(); s2.Text = "2"; t.Add("y", s2); Assert.AreEqual("x", t.FirstValue.Key); Assert.AreEqual("1", t.FirstValue.Value.Text); }