Esempio n. 1
0
		public void Setup()
		{
			_tempFolder = new TemporaryFolder();
			_wordListFilePath = _tempFolder.GetTemporaryFile();
			_filePath = _tempFolder.GetTemporaryFile();
			//Db4oLexModelHelper.InitializeForNonDbTests();
			WeSayWordsProject.InitializeForTests();

			_lexEntryRepository = new LexEntryRepository(_filePath); // InMemoryRecordListManager();
			_glossingLanguageWSId = BasilProject.Project.WritingSystems.TestWritingSystemAnalId;
			_vernacularLanguageWSId = BasilProject.Project.WritingSystems.TestWritingSystemVernId;

			File.WriteAllLines(_wordListFilePath, _words);
			_viewTemplate = new ViewTemplate();
			_viewTemplate.Add(new Field(Field.FieldNames.EntryLexicalForm.ToString(),
										"LexEntry",
										new string[]
											{
													BasilProject.Project.WritingSystems.
															TestWritingSystemVernId
											}));

			_task = new GatherWordListTask( GatherWordListConfig.CreateForTests( _wordListFilePath,_glossingLanguageWSId),
											_lexEntryRepository,
										   _viewTemplate);
		}
Esempio n. 2
0
		public void MissingWordListFileGivesMessage()
		{
			GatherWordListTask g = new GatherWordListTask(
				   GatherWordListConfig.CreateForTests("NotThere.txt",
						   WritingSystem.IdForUnknownAnalysis),
				   _lexEntryRepository,
				   new ViewTemplate());

			 g.Activate(); //should give a box to user, an exception in this text environment
		}
Esempio n. 3
0
		public void EmptyTemplate()
		{
			GatherWordListTask g = new GatherWordListTask(
					GatherWordListConfig.CreateForTests(_wordListFilePath,
							WritingSystem.IdForUnknownAnalysis),
					_lexEntryRepository,
					new ViewTemplate());

			Assert.IsNotNull(g);
		}
Esempio n. 4
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();
        }
Esempio n. 5
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());
        }
Esempio n. 6
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();
        }
Esempio n. 7
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);
        }
Esempio n. 8
0
		public void WritingSystemNotInCurrentListGivesMessage()
		{
			GatherWordListTask g = new GatherWordListTask(
				GatherWordListConfig.CreateForTests(_wordListFilePath,
					"z7z"),
				_lexEntryRepository,
				_viewTemplate);

			g.Activate(); //should give a box to user, an exception in this text environment
		}