Exemplo n.º 1
0
        public void Ctor_EmptyTemplate_DoesntCrash()
        {
            GatherWordListTask g = new GatherWordListTask(
                GatherWordListConfig.CreateForTests(_simpleWordListFilePath,
                                                    WritingSystemsIdsForTests.AnalysisIdForTest, _catalog),
                _lexEntryRepository,
                _viewTemplate, new TaskMemoryRepository());

            g.Activate();
            Assert.IsNotNull(g);
            g.Deactivate();
        }
Exemplo n.º 2
0
        public void Setup()
        {
            WeSayProjectTestHelper.InitializeForTests();
            _glossingLanguageWSId   = WritingSystemsIdsForTests.AnalysisIdForTest;
            _vernacularLanguageWSId = WritingSystemsIdsForTests.VernacularIdForTest;
            BasilProject.Project.WritingSystems.Set(WritingSystemDefinition.Parse("fr"));

            _tempFolder             = new TemporaryFolder();
            _simpleWordListFilePath = _tempFolder.GetTemporaryFile();
//            _liftWordListFile = new TempLiftFile("wordlist.lift",_tempFolder, LiftXml, LiftIO.Validation.Validator.LiftVersion);
            _filePath = _tempFolder.GetTemporaryFile();

            _lexEntryRepository = new LexEntryRepository(_filePath);             // InMemoryRecordListManager();
            File.WriteAllLines(_simpleWordListFilePath, _words);
            _viewTemplate = new ViewTemplate();
            _viewTemplate.Add(new Field(Field.FieldNames.EntryLexicalForm.ToString(),
                                        "LexEntry",
                                        new string[]
            {
                WritingSystemsIdsForTests.VernacularIdForTest
            }));

            _viewTemplate.Add(
                new Field(
                    LexSense.WellKnownProperties.Definition.ToString(),
                    "LexSense",
                    new string[]
            {
                WritingSystemsIdsForTests.AnalysisIdForTest,
                "fr"
            }
                    )
                );

            _viewTemplate.Add(
                new Field(
                    LexSense.WellKnownProperties.Gloss.ToString(),
                    "LexSense",
                    new string[]
            {
                WritingSystemsIdsForTests.AnalysisIdForTest,
                "fr"
            }
                    )
                );
            _catalog = new WordListCatalog();
            _catalog.Add(_simpleWordListFilePath, new WordListDescription("en", "label", "longLabel", "description"));
            _task = new GatherWordListTask(GatherWordListConfig.CreateForTests(_simpleWordListFilePath, _glossingLanguageWSId, _catalog),
                                           _lexEntryRepository,
                                           _viewTemplate, new TaskMemoryRepository());
        }
Exemplo n.º 3
0
        public void Activate_MissingWordListFile_GivesMessage()
        {
            GatherWordListTask g = new GatherWordListTask(
                GatherWordListConfig.CreateForTests("NotThere.txt",
                                                    WritingSystemsIdsForTests.AnalysisIdForTest, new WordListCatalog()),
                _lexEntryRepository,
                _viewTemplate, new TaskMemoryRepository());

            // the code doesn't show the errror box in release builds, but
            // the builder publishing configuration does run tests in release builds
            using (new Palaso.Reporting.ErrorReport.NonFatalErrorReportExpected())
            {
                g.Activate();
            }
            g.Deactivate();
        }
Exemplo n.º 4
0
        private GatherWordListTask CreateAndActivateLiftTask(IEnumerable <string> definitionWritingSystems, string entriesXml)
        {
            var file = new TempLiftFile("wordlist.lift", _tempFolder, entriesXml, Palaso.Lift.Validation.Validator.LiftVersion);

            var vt = new ViewTemplate();

            vt.Add(new Field(
                       Field.FieldNames.EntryLexicalForm.ToString(),
                       "LexEntry",
                       new[] { WritingSystemsIdsForTests.VernacularIdForTest }
                       ));
            vt.Add(new Field(
                       LexSense.WellKnownProperties.Definition.ToString(),
                       "LexSense", definitionWritingSystems
                       ));
            vt.Add(
                new Field(
                    LexSense.WellKnownProperties.Gloss.ToString(),
                    "LexSense",
                    new string[]
            {
                WritingSystemsIdsForTests.AnalysisIdForTest,
                "fr"
            }
                    )
                );

            var t = new GatherWordListTask(
                GatherWordListConfig.CreateForTests(file.Path, "xx", _catalog),
                _lexEntryRepository,
                vt,
                new TaskMemoryRepository()
                );

            t.Activate();
            return(t);
        }