Beispiel #1
0
        private void LoadRecords()
        {
            var selectedItem = CurrentEntry;

            if (IsWritingSystemUsedInLexicalForm(_listWritingSystem.Id))
            {
                _records = _lexEntryRepository.GetAllEntriesSortedByLexicalFormOrAlternative(_listWritingSystem);
            }
            else
            {
                _records = _lexEntryRepository.GetAllEntriesSortedByDefinitionOrGloss(_listWritingSystem);
            }
            _findTextAdapter.Items = _records;

            _recordsListBox.DataSource = new List <RecordToken <LexEntry> >(_records);
            if (selectedItem != null)
            {
                _recordsListBox.SelectedIndex = _records.FindFirstIndex(selectedItem);
            }
        }
Beispiel #2
0
        public void GetAllEntriesSortedByDefinition_CreateItemAfterFirstCall_EntryIsReturnedAndSortedInResultSet()
        {
            LexEntry entryBeforeFirstQuery = CreateEntryWithDefinitionBeforeFirstQuery("de", "word 1");

            _repository.GetAllEntriesSortedByDefinitionOrGloss(WritingSystemDefinition.Parse("de"));

            LexEntry entryAfterFirstQuery = CreateEntryWithDefinitionBeforeFirstQuery("de", "word 2");

            ResultSet <LexEntry> results = _repository.GetAllEntriesSortedByDefinitionOrGloss(WritingSystemDefinition.Parse("de"));

            Assert.AreEqual(2, results.Count);
            Assert.AreEqual("word 1", results[0]["Form"]);
            Assert.AreEqual("word 2", results[1]["Form"]);
        }