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); }
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 }
public void EmptyTemplate() { GatherWordListTask g = new GatherWordListTask( GatherWordListConfig.CreateForTests(_wordListFilePath, WritingSystem.IdForUnknownAnalysis), _lexEntryRepository, new ViewTemplate()); Assert.IsNotNull(g); }
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(); }
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()); }
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(); }
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); }
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 }