public void Setup()
		{
			Field field = new Field(Field.FieldNames.EntryLexicalForm.ToString(),
									"LexEntry",
									new string[] {"vernacular"});
			_missingLexicalFormFilter = new MissingFieldQuery(field);
		}
		public void Setup()
		{
			Field field = new Field(LexSense.WellKnownProperties.Definition,
									"LexSense",
									new string[] {"analysis"});
			_missingMeaningFilter = new MissingFieldQuery(field);
		}
		public void Setup()
		{
			Field field = new Field(Field.FieldNames.ExampleSentence.ToString(),
									"LexExampleSentence",
									new string[] {"vernacular"});
			_missingExampleSentenceFilter = new MissingFieldQuery(field);
		}
		public void Setup()
		{
			Field field = new Field(Field.FieldNames.ExampleTranslation.ToString(),
									"LexExampleSentence",
									new string[] {"analysis"});
			_missingExampleTranslationFilter = new MissingFieldQuery(field);
		}
Example #5
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 Setup()
        {
            Field field = new Field(Field.FieldNames.ExampleSentence.ToString(),
                                    "LexExampleSentence",
                                    new string[] { "vernacular" });

            _missingExampleSentenceFilter = new MissingFieldQuery(field, null, null);
        }
        public void Setup()
        {
            Field field = new Field(Field.FieldNames.ExampleTranslation.ToString(),
                                    "LexExampleSentence",
                                    new string[] { "analysis" });

            _missingExampleTranslationFilter = new MissingFieldQuery(field, null, null);
        }
Example #8
0
        public void Setup()
        {
            Field field = new Field(Field.FieldNames.EntryLexicalForm.ToString(),
                                    "LexEntry",
                                    new string[] { "vernacular" });

            _missingLexicalFormFilter = new MissingFieldQuery(field, null, null);
        }
Example #9
0
        public void Setup()
        {
            Field field = new Field(LexSense.WellKnownProperties.Definition,
                                    "LexSense",
                                    new string[] { "analysis" });

            _missingMeaningFilter = new MissingFieldQuery(field, null, null);
        }
        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));
        }
        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));
        }
Example #12
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));
        }
Example #13
0
        public void Setup()
        {
            var field = new Field("customField",
                                  "LexSense",
                                  new[] { "vernacular" },
                                  Field.MultiplicityType.ZeroOr1,
                                  "Option");

            _missingCustomFieldFilter = new MissingFieldQuery(field, null, null);
        }
Example #14
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));
        }
Example #15
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));
        }
Example #16
0
		public void Key_MultipleWSInDifferentOrder_Same()
		{
			MissingFieldQuery filter1 =
					new MissingFieldQuery(new Field("customField",
													"LexExampleSentence",
													new string[] {"vernacular", "analysis"}));
			MissingFieldQuery filter2 =
					new MissingFieldQuery(new Field("customField",
													"LexExampleSentence",
													new string[] {"analysis", "vernacular"}));
			Assert.IsTrue(filter1.Key == filter2.Key);
		}
Example #17
0
		public void Key_DifferentWS_Different()
		{
			MissingFieldQuery filter1 =
					new MissingFieldQuery(new Field("customField",
													"LexExampleSentence",
													new string[] {"vernacular"}));
			MissingFieldQuery filter2 =
					new MissingFieldQuery(new Field("customField",
													"LexExampleSentence",
													new string[] {"analysis"}));
			Assert.IsFalse(filter1.Key == filter2.Key);
		}
        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));
        }
Example #19
0
		public void Key_SameFieldParameters_Same()
		{
			MissingFieldQuery filter1 =
					new MissingFieldQuery(new Field("customField",
													"LexExampleSentence",
													new string[] {"vernacular"}));
			MissingFieldQuery filter2 =
					new MissingFieldQuery(new Field("customField",
													"LexExampleSentence",
													new string[] {"vernacular"}));
			Assert.IsTrue(filter1.Key == filter2.Key);
		}
        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));
        }
        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));
        }
Example #22
0
        public void Key_MultipleWSInDifferentOrder_Same()
        {
            MissingFieldQuery filter1 =
                new MissingFieldQuery(new Field("customField",
                                                "LexExampleSentence",
                                                new string[] { "vernacular", "analysis" }), null, null);
            MissingFieldQuery filter2 =
                new MissingFieldQuery(new Field("customField",
                                                "LexExampleSentence",
                                                new string[] { "analysis", "vernacular" }), null, null);

            Assert.IsTrue(filter1.Key == filter2.Key);
        }
Example #23
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));
        }
Example #24
0
        public void Key_SameFieldParameters_Same()
        {
            MissingFieldQuery filter1 =
                new MissingFieldQuery(new Field("customField",
                                                "LexExampleSentence",
                                                new string[] { "vernacular" }), null, null);
            MissingFieldQuery filter2 =
                new MissingFieldQuery(new Field("customField",
                                                "LexExampleSentence",
                                                new string[] { "vernacular" }), null, null);

            Assert.IsTrue(filter1.Key == filter2.Key);
        }
Example #25
0
            public void TestFilter(int result, IEnumerable <string> emptyWsInField, IEnumerable <string> populatedWsInField,
                                   IEnumerable <string> wsThatMustBeEmpty, IEnumerable <string> wsThatMustBePopulated)
            {
                var allFieldWs = emptyWsInField.Concat(populatedWsInField).Concat(wsThatMustBeEmpty).Concat(wsThatMustBePopulated);

                CreateEntryWithDefinitionAndWs(populatedWsInField, emptyWsInField);
                Field fieldToFill                  = new Field(LexSense.WellKnownProperties.Definition, "LexSense", allFieldWs);
                var   missingFieldFilter           = new MissingFieldQuery(fieldToFill, wsThatMustBeEmpty.ToArray(), wsThatMustBePopulated.ToArray());
                ResultSet <LexEntry> sortedResults =
                    _repository.GetEntriesWithMissingFieldSortedByLexicalUnit(missingFieldFilter, _vernacularWritingSystem);

                Assert.AreEqual(result, sortedResults.Count);
            }
Example #26
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));
        }
Example #27
0
        public void Key_DifferentWS_Different()
        {
            MissingFieldQuery filter1 =
                new MissingFieldQuery(new Field("customField",
                                                "LexExampleSentence",
                                                new string[] { "vernacular" }), null, null);
            MissingFieldQuery filter2 =
                new MissingFieldQuery(new Field("customField",
                                                "LexExampleSentence",
                                                new string[] { "analysis" }), null, null);

            Assert.IsFalse(filter1.Key == filter2.Key);
        }
		public void Setup()
		{
			_tempFolder = new TemporaryFolder();
			_filePath = _tempFolder.GetTemporaryFile();
			_lexEntryRepository = new LexEntryRepository(_filePath);

			_target = _lexEntryRepository.CreateItem();
			_source = _lexEntryRepository.CreateItem();

			Field relationField = new Field("synonyms",
											"LexEntry",
											new string[] {"vernacular"},
											Field.MultiplicityType.ZeroOr1,
											"RelationToOneEntry");
			_missingRelationFieldFilter = new MissingFieldQuery(relationField);
		}
        public void Setup()
        {
            _tempFolder         = new TemporaryFolder();
            _filePath           = _tempFolder.GetTemporaryFile();
            _lexEntryRepository = new LexEntryRepository(_filePath);

            _target = _lexEntryRepository.CreateItem();
            _source = _lexEntryRepository.CreateItem();

            Field relationField = new Field("synonyms",
                                            "LexEntry",
                                            new string[] { "vernacular" },
                                            Field.MultiplicityType.ZeroOr1,
                                            "RelationToOneEntry");

            _missingRelationFieldFilter = new MissingFieldQuery(relationField, null, null);
        }
        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));
        }
Example #31
0
        public void Setup()
        {
            var field = new Field("customField", "LexEntry", new[] { "vernacular" });

            _missingCustomFieldFilter = new MissingFieldQuery(field, null, null);
        }
Example #32
0
		public override void Activate()
		{
			base.Activate();

			Predicate<LexEntry> filteringPredicate =
				new MissingFieldQuery(_missingInfoField).FilteringPredicate;
			_missingInfoControl = new MissingInfoControl(GetFilteredData(),
														 ViewTemplate,
														 filteringPredicate,
														 LexEntryRepository);
			_missingInfoControl.SelectedIndexChanged += OnRecordSelectionChanged;
		}
		public void Setup()
		{
			Field field = new Field("customField",
									"LexSense",
									new string[] {"vernacular"},
									Field.MultiplicityType.ZeroOr1,
									"Option");
			_missingCustomFieldFilter = new MissingFieldQuery(field);
		}
Example #34
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 Setup()
		{
			Field field = new Field("customField", "LexEntry", new string[] {"vernacular"});
			_missingCustomFieldFilter = new MissingFieldQuery(field);
		}