Esempio n. 1
0
        public void LexicalFormHasAnalysisWritingSystem()
        {
            LexEntry entry = new LexEntry();

            entry.LexicalForm["vernacular"] = "filler";

            Assert.AreEqual(false, _missingLexicalFormFilter.FilteringPredicate(entry));
        }
Esempio n. 2
0
        public void LexEntryCustomFieldHasVernacularWritingSystem()
        {
            var entry  = new LexEntry();
            var custom = entry.GetOrCreateProperty <MultiText>("customField");

            custom["vernacular"] = "filler";

            Assert.AreEqual(false, _missingCustomFieldFilter.FilteringPredicate(entry));
        }
Esempio n. 3
0
        public void SenseHasCustomField()
        {
            var entry = new LexEntry();
            var sense = new LexSense();

            entry.Senses.Add(sense);
            var custom = sense.GetOrCreateProperty <OptionRef>("customField");

            custom.Value = "filler";

            Assert.AreEqual(false, _missingCustomFieldFilter.FilteringPredicate(entry));
        }
        public void SenseExampleSentenceHasVernacularWritingSystem()
        {
            LexEntry           entry   = CreateEmptyEntryWithOneExampleSentence();
            LexExampleSentence example = entry.Senses[0].ExampleSentences[0];

            example.Sentence["vernacular"] = "filler";

            Assert.AreEqual(false, _missingExampleSentenceFilter.FilteringPredicate(entry));
        }
Esempio n. 5
0
        public void SenseExampleCustomFieldHasVernacularWritingSystem()
        {
            var entry   = CreateEmptyLexEntryWithOneEmptySentence();
            var example = entry.Senses[0].ExampleSentences[0];

            var custom = example.GetOrCreateProperty <MultiText>("customField");

            custom["vernacular"] = "filler";

            Assert.AreEqual(false, _missingCustomFieldFilter.FilteringPredicate(entry));
        }
Esempio n. 6
0
        public void FilteringPredicate_Null_False()
        {
            Field             field = new Field("customField", "LexExampleSentence", new string[] { "vernacular" });
            MissingFieldQuery f     = new MissingFieldQuery(field, null, null);

            Assert.IsFalse(f.FilteringPredicate(null));
        }
        public void SenseExampleTranslationHasAnalysisWritingSystem()
        {
            LexEntry entry = new LexEntry();
            LexSense sense = new LexSense();

            entry.Senses.Add(sense);
            LexExampleSentence example = new LexExampleSentence();

            sense.ExampleSentences.Add(example);

            example.Translation["analysis"] = "filler";

            Assert.AreEqual(false, _missingExampleTranslationFilter.FilteringPredicate(entry));
        }
        public void ExampleSentenceHasOneWSButNotOneWeDontCareAbout_True()
        {
            var entry = MakeEntryWithExampleSentence(new string[] { "one" });

            Field             field = new Field(LexExampleSentence.WellKnownProperties.ExampleSentence, "LexExampleSentence", new string[] { "one", "two" });
            MissingFieldQuery f     = new MissingFieldQuery(field, new string[] { "two" }, null);

            Assert.IsTrue(f.FilteringPredicate(entry));
        }
        public void DefinitionHasOneWSButNotTheOneWeWant_False()
        {
            var entry = MakeEntryWithSense(new string[] { "two" });

            Field             field = new Field(LexSense.WellKnownProperties.Definition, "LexSense", new string[] { "one", "two" });
            MissingFieldQuery f     = new MissingFieldQuery(field, new string[] { "two" }, null);

            Assert.IsFalse(f.FilteringPredicate(entry));
        }
Esempio n. 10
0
        public void FilteringPredicate_EntryDoesNotHaveAnInstanceOfTheField_IsNotChosen()
        {
            var entry = new LexEntry();

            var field = new Field("customField", "LexEntry", new[] { "en", "fr" });
            var hasEnglishButNotFrenchFilter = new MissingFieldQuery(field, new string[] { "fr" }, new string[] { "en" });

            Assert.IsFalse(hasEnglishButNotFrenchFilter.FilteringPredicate(entry));
        }
Esempio n. 11
0
        public void FilteringPredicate_PartOfSpeechIsNull_True()
        {
            LexEntry entryWithUnknownPos = new LexEntry();

            entryWithUnknownPos.LexicalForm.SetAlternative("de", "LexicalForm");
            entryWithUnknownPos.Senses.Add(new LexSense());
            Field             field = new Field("POS", "LexSense", new string[] { "en" }, Field.MultiplicityType.ZeroOr1, "Option");
            MissingFieldQuery f     = new MissingFieldQuery(field, null, null);

            Assert.IsTrue(f.FilteringPredicate(entryWithUnknownPos));
        }
        public void ExampleSentenceMissingOurWSButAlsoMissingARequiredWS_False()
        {
            var entry = MakeEntryWithExampleSentence(new string[] { "roman" });

            Field field = new Field(LexExampleSentence.WellKnownProperties.ExampleSentence, "LexExampleSentence", new string[] { "roman", "thai", "voice" });
            var   writingSystemsWhichWeWantToFillIn = new string[] { "voice" };
            var   writingSystemsWhichAreRequired    = new string[] { "thai" };

            MissingFieldQuery f = new MissingFieldQuery(field, writingSystemsWhichWeWantToFillIn, writingSystemsWhichAreRequired);

            Assert.IsFalse(f.FilteringPredicate(entry));
        }
Esempio n. 13
0
        public void DefinitionMissingButSomeWsIsRequired_False()
        {
            var entry = new LexEntry();
            var sense = new LexSense();

            entry.Senses.Add(sense);

            Field             field = new Field(LexSense.WellKnownProperties.Definition, "LexSense", new string[] { "one", "two" });
            MissingFieldQuery f     = new MissingFieldQuery(field, new string[] { "two" }, new string[] { "one" });

            Assert.IsFalse(f.FilteringPredicate(entry));
        }
Esempio n. 14
0
        public void FilteringPredicate_HasRequiredButNotEmpty_IsChosen()
        {
            var entry  = new LexEntry();
            var custom = entry.GetOrCreateProperty <MultiText>("customField");

            custom["en"] = "hello";

            var field = new Field("customField", "LexEntry", new[] { "en", "fr" });
            var hasEnglishButNotFrenchFilter = new MissingFieldQuery(field, new string[] { "fr" }, new string[] { "en" });

            Assert.IsTrue(hasEnglishButNotFrenchFilter.FilteringPredicate(entry));
        }
        public void ExampleSentenceMissingAndThereIsARequiredWritingSystem_False()
        {
            var entry = new LexEntry();
            var sense = new LexSense();

            entry.Senses.Add(sense);

            Field             field = new Field(LexExampleSentence.WellKnownProperties.ExampleSentence, "LexExampleSentence", new string[] { "one", "two" });
            MissingFieldQuery f     = new MissingFieldQuery(field, new string[] { "two" }, new string[] { "one" });

            Assert.IsFalse(f.FilteringPredicate(entry));
        }
Esempio n. 16
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));
        }
Esempio n. 17
0
        public void FilteringPredicate_PartOfSpeechIsUnknown_True()
        {
            LexEntry entryWithUnknownPos = new LexEntry();

            entryWithUnknownPos.LexicalForm.SetAlternative("de", "LexicalForm");
            entryWithUnknownPos.Senses.Add(new LexSense());
            entryWithUnknownPos.Senses[0].Properties.Add(new KeyValuePair <string, IPalasoDataObjectProperty>("POS", new OptionRef()));
            ((OptionRef)entryWithUnknownPos.Senses[0].Properties[0].Value).Key = "unknown";
            Field             field = new Field("POS", "LexSense", new string[] { "en" }, Field.MultiplicityType.ZeroOr1, "Option");
            MissingFieldQuery f     = new MissingFieldQuery(field, null, null);

            Assert.IsTrue(f.FilteringPredicate(entryWithUnknownPos));
        }
Esempio n. 18
0
        public void SenseDefinitionHasAnalysisWritingSystem()
        {
            LexEntry entry = CreateEmptyEntryWithOneSense();
            LexSense sense = entry.Senses[0];

            sense.Definition["analysis"] = "filler";

            Assert.AreEqual(false, _missingMeaningFilter.FilteringPredicate(entry));
        }
        public void SenseExampleTranslation_MissingOneUnsearchedWritingSystem_NotReturned()
        {
            LexEntry entry = new LexEntry();
            LexSense sense = new LexSense();

            entry.Senses.Add(sense);
            LexExampleSentence example = new LexExampleSentence();

            sense.ExampleSentences.Add(example);

            example.Translation["one"] = "filler";
            Field field = new Field(Field.FieldNames.ExampleTranslation.ToString(),
                                    "LexExampleSentence",
                                    new string[] { "one", "two" });

            var filter = new MissingFieldQuery(field, new[] { "one" }, null);         //notice, we don't want to search in "two"

            Assert.AreEqual(false, filter.FilteringPredicate(entry));
        }
Esempio n. 20
0
		public void FilteringPredicate_Null_False()
		{
			Field field = new Field("customField", "LexExampleSentence", new string[] {"vernacular"});
			MissingFieldQuery f = new MissingFieldQuery(field);
			Assert.IsFalse(f.FilteringPredicate(null));
		}
 public void FieldHasContents()
 {
     AddRelation();
     Assert.IsFalse(_missingRelationFieldFilter.FilteringPredicate(_source));
 }