示例#1
0
        public void Cleanup_HasBaseform_PropertyIsNotRemoved()
        {
            var target = new LexEntry();

            _entry = new LexEntry();
            _entry.LexicalForm["v"] = "hello";
            _entry.AddRelationTarget(LexEntry.WellKnownProperties.BaseForm, target.GetOrCreateId(true));
            _entry.CleanUpAfterEditting();
            Assert.IsNotNull(_entry.GetProperty <LexRelationCollection>(LexEntry.WellKnownProperties.BaseForm));
        }
示例#2
0
        public void RelationEntry_NotFound_NothingExported()
        {
            using (var environment = new EnvironmentForTest())
            {
                LexEntry entry = environment.Repo.CreateItem();
                entry.LexicalForm.SetAlternative(environment.HeadwordWritingSystem.Id, "Gary");
                entry.AddRelationTarget("brother", "notGonnaFindIt");
                environment.Repo.SaveItem(entry);

                environment.DoExport();
                environment.CheckRelationNotOutput("brother");
            }
        }
示例#3
0
        private static void CheckRelationFilter(string relationname, string targetId, bool shouldMatch)
        {
            LexEntry entry = new LexEntry();

            entry.AddRelationTarget(relationname, targetId);
            Field field = new Field(relationname, "LexEntry",
                                    new string[] { "vernacular" },
                                    Field.MultiplicityType.ZeroOr1,
                                    "RelationToOneEntry");
            MissingFieldQuery f = new MissingFieldQuery(field, null, null);

            Assert.AreEqual(shouldMatch, f.FilteringPredicate(entry));
        }
示例#4
0
        public void RelationEntry_Found_HeadWordExported()
        {
            using (var environment = new EnvironmentForTest())
            {
                LexEntry targetEntry = environment.Repo.CreateItem();

                targetEntry.LexicalForm.SetAlternative(environment.HeadwordWritingSystem.Id, "RickLexeme");
                targetEntry.CitationForm.SetAlternative(environment.HeadwordWritingSystem.Id, "Rick");
                environment.Repo.SaveItem(targetEntry);

                LexEntry entry = environment.Repo.CreateItem();
                entry.LexicalForm.SetAlternative(environment.HeadwordWritingSystem.Id, "Gary");
                environment.Repo.SaveItem(entry);

                entry.AddRelationTarget("brother", targetEntry.Id);

                environment.DoExport();
                environment.CheckRelationOutput(targetEntry, "brother");
            }
        }