public void Cleanup_HasEmptyBaseform_PropertyIsRemoved() { var target = new LexEntry(); _entry = new LexEntry(); _entry.LexicalForm["v"] = "hello"; _entry.AddRelationTarget(LexEntry.WellKnownProperties.BaseForm, string.Empty); Assert.IsNotNull(_entry.GetProperty <LexRelationCollection>(LexEntry.WellKnownProperties.BaseForm)); _entry.CleanUpAfterEditting(); Assert.IsNull(_entry.GetProperty <LexRelationCollection>(LexEntry.WellKnownProperties.BaseForm)); }
public void MergeInNote_NoteHasTypeOtherThanGeneral_AllGoesToRoundTripResidue() { LexEntry e = MakeSimpleEntry(); _builder.MergeInNote(e, "red", MakeBasicLiftMultiText(), "<pretendXmlOfNote/>"); MultiText mt = e.GetProperty <MultiText>(PalasoDataObject.WellKnownProperties.Note); Assert.IsNull(mt); var residue = e.GetProperty <EmbeddedXmlCollection>(PalasoDataObject.GetEmbeddedXmlNameForProperty(PalasoDataObject.WellKnownProperties.Note)); Assert.AreEqual(1, residue.Values.Count); Assert.AreEqual("<pretendXmlOfNote/>", residue.Values[0]); }
public void NewEntry_OldLiteralMeaning_GetsMoved() { // _builder.AfterEntryRead += _builder.ApplyWeSayPolicyToParsedEntry; Extensible extensibleInfo = new Extensible(); LexEntry e = _builder.GetOrMakeEntry(extensibleInfo, 0); LexSense s = _builder.GetOrMakeSense(e, new Extensible(), string.Empty); LiftMultiText t = new LiftMultiText("en", "test"); _builder.MergeInField(s, "LiteralMeaning", default(DateTime), default(DateTime), t, null); _builder.FinishEntry(e); Assert.IsNull(e.Senses[0].GetProperty <MultiText>("LiteralMeaning")); Assert.IsNotNull(e.GetProperty <MultiText>(LexEntry.WellKnownProperties.LiteralMeaning)); Assert.AreEqual("test", e.GetProperty <MultiText>(LexEntry.WellKnownProperties.LiteralMeaning).GetExactAlternative("en")); }
public void MergeInNote_NoType_AfterFirstTheyGoesToRoundTripResidue() { LexEntry e = MakeSimpleEntry(); _builder.MergeInNote(e, string.Empty, MakeBasicLiftMultiText("first"), "pretend xml one"); _builder.MergeInNote(e, string.Empty, MakeBasicLiftMultiText("second"), "<pretend xml two/>"); _builder.MergeInNote(e, string.Empty, MakeBasicLiftMultiText("third"), "<pretend xml three/>"); MultiText mt = e.GetProperty <MultiText>(PalasoDataObject.WellKnownProperties.Note); Assert.AreEqual("first", mt["ws-one"]); var residue = e.GetProperty <EmbeddedXmlCollection>(PalasoDataObject.GetEmbeddedXmlNameForProperty(PalasoDataObject.WellKnownProperties.Note)); Assert.AreEqual(2, residue.Values.Count); Assert.AreEqual("<pretend xml two/>", residue.Values[0]); Assert.AreEqual("<pretend xml three/>", residue.Values[1]); }
public void MergeInNote_NoteHasTypeOfGeneral_Added() { LexEntry e = MakeSimpleEntry(); _builder.MergeInNote(e, "general", MakeBasicLiftMultiText(), string.Empty); MultiText mt = e.GetProperty <MultiText>(PalasoDataObject.WellKnownProperties.Note); Assert.AreEqual("uno", mt["ws-one"]); Assert.AreEqual("dos", mt["ws-two"]); }
public void UnexpectedAtomicTraitRetained() { LexEntry e = MakeSimpleEntry(); _builder.MergeInTrait(e, new Trait("flub", "dub")); Assert.AreEqual(1, e.Properties.Count); Assert.AreEqual("flub", e.Properties[0].Key); OptionRefCollection option = e.GetProperty <OptionRefCollection>("flub"); Assert.IsTrue(option.Contains("dub")); }
public void ExpectedAtomicTraitOnEntry() { _builder.ExpectedOptionTraits = new[] { "flub" }; LexEntry e = MakeSimpleEntry(); _builder.MergeInTrait(e, new Trait("flub", "dub")); Assert.AreEqual(1, e.Properties.Count); Assert.AreEqual("flub", e.Properties[0].Key); OptionRef option = e.GetProperty <OptionRef>("flub"); Assert.AreEqual("dub", option.Value); }
public void UnexpectedCustomFieldRetained() { LexEntry e = MakeSimpleEntry(); LiftMultiText t = new LiftMultiText(); t["z"] = new LiftString("dub"); _builder.MergeInField(e, "flub", default(DateTime), default(DateTime), t, null); Assert.AreEqual(1, e.Properties.Count); Assert.AreEqual("flub", e.Properties[0].Key); MultiText mt = e.GetProperty <MultiText>("flub"); Assert.AreEqual("dub", mt["z"]); }
public void ExpectedCollectionTrait() { _builder.ExpectedOptionCollectionTraits.Add("flub"); LexEntry e = MakeSimpleEntry(); _builder.MergeInTrait(e, new Trait("flub", "dub")); _builder.MergeInTrait(e, new Trait("flub", "stub")); Assert.AreEqual(1, e.Properties.Count); Assert.AreEqual("flub", e.Properties[0].Key); OptionRefCollection options = e.GetProperty <OptionRefCollection>("flub"); Assert.AreEqual(2, options.Count); Assert.IsTrue(options.Contains("dub")); Assert.IsTrue(options.Contains("stub")); }
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"]); }