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 Setup() { WeSayProjectTestHelper.InitializeForTests(); _tempFolder = new TemporaryFolder(); _filePath = _tempFolder.GetTemporaryFile(); _lexEntryRepository = new LexEntryRepository(_filePath); _target = CreateEntry("one", "single item"); _source = CreateEntry("single", "one item"); CreateEntry("verde", "green"); CreateEntry("amarelho", "yellow"); CreateEntry("azul", "blue"); _synonymsRelationField = new Field("synonyms", "LexEntry", new string[] { WritingSystemsIdsForTests.OtherIdForTest }, Field.MultiplicityType.ZeroOrMore, "RelationToOneEntry"); _synonymsRelationType = new LexRelationType("synonyms", LexRelationType.Multiplicities.Many, LexRelationType.TargetTypes.Sense); _singleSynonymRelationField = new Field("synonym", "LexEntry", new string[] { WritingSystemsIdsForTests.OtherIdForTest }, Field.MultiplicityType.ZeroOr1, "RelationToOneEntry"); _singleSynonymRelationType = new LexRelationType("synonym", LexRelationType.Multiplicities.One, LexRelationType.TargetTypes.Sense); }
public override void SetUp() { _tempFolder = new TemporaryFolder(); _persistedFilePath = _tempFolder.GetTemporaryFile(); LiftFileInitializer.MakeFile(_persistedFilePath); DataMapperUnderTest = LiftRepositoryStateUnitializedTests.CreateDataMapper(_persistedFilePath); }
public void Setup() { _temporaryFolder = new TemporaryFolder(); string filePath = _temporaryFolder.GetTemporaryFile(); _lexEntryRepository = new LexEntryRepository(filePath); }
public void Setup() { _tempfolder = new TemporaryFolder(); string persistedFilePath = _tempfolder.GetTemporaryFile(); _repository = new LiftLexEntryRepository(persistedFilePath); }
public void Setup() { _tempFolder = new TemporaryFolder(); _filePath = _tempFolder.GetTemporaryFile(); WeSayProjectTestHelper.InitializeForTests(); string[] vernacularWritingSystemIds = new string[] { WritingSystemsIdsForTests.VernacularIdForTest }; _viewTemplate = new ViewTemplate(); _viewTemplate.Add(new Field(Field.FieldNames.EntryLexicalForm.ToString(), "LexEntry", vernacularWritingSystemIds)); _viewTemplate.Add(new Field("Note", "LexEntry", new string[] { "en" }, Field.MultiplicityType.ZeroOr1, "MultiText")); _lexEntryRepository = new LexEntryRepository(_filePath); EntryViewControl.Factory entryViewFactory = (() => new EntryViewControl()); _dictControlFactory = (memory => new DictionaryControl(entryViewFactory, _lexEntryRepository, _viewTemplate, memory, new StringLogger())); _taskMemoryRepository = new TaskMemoryRepository(); _task = new DictionaryTask(_dictControlFactory, DictionaryBrowseAndEditConfiguration.CreateForTests("definition"), _lexEntryRepository, _taskMemoryRepository); // _task = new DictionaryTask( DictionaryBrowseAndEditConfiguration.CreateForTests(), _lexEntryRepository, // _viewTemplate, new TaskMemoryRepository(), new StringLogger())};//, new UserSettingsForTask()); }
public TestEnvironment() { _temporaryFolder = new TemporaryFolder(); string filePath = _temporaryFolder.GetTemporaryFile(); _repository = new LexEntryRepository(filePath); }
public void SetUp() { WeSayProjectTestHelper.InitializeForTests(); _tempFolder = new TemporaryFolder(); _filePath = _tempFolder.GetTemporaryFile(); _lexEntryRepository = new LexEntryRepository(_filePath); #if GlossMeaning _primaryMeaningFieldName = Field.FieldNames.SenseGloss.ToString(); #else _primaryMeaningFieldName = LexSense.WellKnownProperties.Definition; #endif string[] analysisWritingSystemIds = new string[] { WritingSystemsIdsForTests.AnalysisIdForTest }; string[] vernacularWritingSystemIds = new string[] { WritingSystemsIdsForTests.VernacularIdForTest }; RtfRenderer.HeadWordWritingSystemId = vernacularWritingSystemIds[0]; _viewTemplate = new ViewTemplate(); _viewTemplate.Add(new Field(Field.FieldNames.EntryLexicalForm.ToString(), "LexEntry", vernacularWritingSystemIds)); _viewTemplate.Add(new Field(_primaryMeaningFieldName, "LexSense", analysisWritingSystemIds)); _viewTemplate.Add(new Field(Field.FieldNames.ExampleSentence.ToString(), "LexExampleSentence", vernacularWritingSystemIds)); _viewTemplate.Add(new Field(Field.FieldNames.ExampleTranslation.ToString(), "LexExampleSentence", analysisWritingSystemIds)); empty = CreateTestEntry("", "", ""); apple = CreateTestEntry("apple", "red thing", "An apple a day keeps the doctor away."); banana = CreateTestEntry("banana", "yellow food", "Monkeys like to eat bananas."); car = CreateTestEntry("car", "small motorized vehicle", "Watch out for cars when you cross the street."); bike = CreateTestEntry("bike", "vehicle with two wheels", "He rides his bike to school."); }
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 SetUp() { WeSayProjectTestHelper.InitializeForTests(); _tempFolder = new TemporaryFolder(); _filePath = _tempFolder.GetTemporaryFile(); _lexEntryRepository = new LexEntryRepository(_filePath); _writingSystem = WritingSystemDefinition.Parse(WritingSystemsIdsForTests.OtherIdForTest); CreateTestEntry("apple", "red thing", "An apple a day keeps the doctor away."); CreateTestEntry("banana", "yellow food", "Monkeys like to eat bananas."); CreateTestEntry("car", "small motorized vehicle", "Watch out for cars when you cross the street."); CreateTestEntry("dog", "animal with four legs; man's best friend", "He walked his dog."); string[] analysisWritingSystemIds = new[] { WritingSystemsIdsForTests.AnalysisIdForTest }; string[] vernacularWritingSystemIds = new[] { _writingSystem.Id }; RtfRenderer.HeadWordWritingSystemId = vernacularWritingSystemIds[0]; _viewTemplate = new ViewTemplate { new Field(Field.FieldNames.EntryLexicalForm.ToString(), "LexEntry", vernacularWritingSystemIds), new Field(LexSense.WellKnownProperties.Definition, "LexSense", analysisWritingSystemIds), new Field(Field.FieldNames.ExampleSentence.ToString(), "LexExampleSentence", vernacularWritingSystemIds) }; var exampleTranslationField = new Field( Field.FieldNames.ExampleTranslation.ToString(), "LexExampleSentence", analysisWritingSystemIds ); _viewTemplate.Add(exampleTranslationField); _missingTranslationRecordList = _lexEntryRepository.GetEntriesWithMissingFieldSortedByLexicalUnit( exampleTranslationField, null, _writingSystem); }
public void Setup() { _tempFolder = new TemporaryFolder(); _filePath = _tempFolder.GetTemporaryFile(); _lexEntryRepository = new LexEntryRepository(_filePath); WeSayProjectTestHelper.InitializeForTests(); RtfRenderer.HeadWordWritingSystemId = _vernacularWritingSystemId; _missingFieldName = LexSense.WellKnownProperties.Definition; LexEntry entry = _lexEntryRepository.CreateItem(); _lexicalForm = "vernacular"; entry.LexicalForm.SetAlternative(_vernacularWritingSystemId, _lexicalForm); _lexEntryRepository.SaveItem(entry); _longLabel = "Long label"; _remainingCountText = "Remaining count:"; _referenceCountText = "Reference count:"; _fieldsToShow = "LexicalForm"; _label = "My label"; _description = "My description"; _viewTemplate = new ViewTemplate(); _viewTemplate.Add(new Field(LexEntry.WellKnownProperties.LexicalUnit, "LexEntry", new string[] { _vernacularWritingSystemId })); _viewTemplate.Add(new Field(LexSense.WellKnownProperties.Definition, "LexSense", new string[] { "en" })); _viewTemplate.Add(new Field(Field.FieldNames.ExampleSentence.ToString(), "LexExampleSentence", new string[] { "th" })); _task = CreateMissingInfoTask(_lexEntryRepository, _missingFieldName, _label, _longLabel, _description, _remainingCountText, _referenceCountText, _viewTemplate, _fieldsToShow, string.Empty); }
private void SetupTestData() { Palaso.Reporting.ErrorReport.IsOkToInteractWithUser = false; _tempFolder = new TemporaryFolder(); _filePath = _tempFolder.GetTemporaryFile(); _currentItem = null; string lexicalForm = "test"; string definition = "definition"; string exampleSentence = "Test sentence"; string exampleTranslation = "Translated sentence"; _lexEntryRepository = (LexEntryRepository) WeSayWordsProject.Project.ServiceLocator.GetService(typeof(LexEntryRepository)); _viewTemplate = (ViewTemplate) WeSayWordsProject.Project.ServiceLocator.GetService(typeof(ViewTemplate)); List <String> headwordWritingSystemIds = new List <string>(_viewTemplate.GetHeadwordWritingSystemIds()); string wsA = headwordWritingSystemIds[0]; string wsB = _viewTemplate.GetDefaultWritingSystemForField(definition).Id; HtmlRenderer.HeadWordWritingSystemId = _viewTemplate.HeadwordWritingSystem.Id; _entry = _lexEntryRepository.CreateItem(); _entry.LexicalForm[wsA] = lexicalForm; LexSense sense = new LexSense(); sense.Definition[wsB] = definition; LexExampleSentence example = new LexExampleSentence(); example.Sentence[wsA] = exampleSentence; example.Translation[wsB] = exampleTranslation; sense.ExampleSentences.Add(example); _entry.Senses.Add(sense); empty = CreateTestEntry("", "", ""); apple = CreateTestEntry("apple", "red thing", "An apple a day keeps the doctor away."); anotherApple = CreateTestEntry("apple", "fruit", "An apple a day keeps the doctor away."); banana = CreateTestEntry("banana", "yellow food", "Monkeys like to eat bananas."); car = CreateTestEntry("car", "small motorized vehicle", "Watch out for cars when you cross the street."); bike = CreateTestEntry("bike", "vehicle with two wheels", "He rides his bike to school."); }
public void Setup() { _tempFolder = new TemporaryFolder(); _filePath = _tempFolder.GetTemporaryFile(); _lexEntryRepository = new LexEntryRepository(_filePath); Form window = new Form(); window.Size = new Size(800, 600); _lexEntryRepository.CreateItem(); Dash dash = new Dash(_lexEntryRepository, null); //, new UserSettingsForTask()); dash.ThingsToMakeButtonsFor = GetButtonItems(); dash.Dock = DockStyle.Fill; window.Controls.Add(dash); window.BackColor = dash.BackColor; dash.Activate(); Application.Run(window); }
public void UnlockedLiftFile_ConstructorDoesNotThrow() { string persistedFilePath = _tempFolder.GetTemporaryFile(); persistedFilePath = Path.GetFullPath(persistedFilePath); // Confirm that the file is writable. FileStream fileStream = File.OpenWrite(persistedFilePath); Assert.IsTrue(fileStream.CanWrite); // Close it before creating the LiftDataMapper. fileStream.Close(); // LiftDataMapper constructor shouldn't throw an IOException. using (LiftDataMapper liftDataMapper = LiftRepositoryStateUnitializedTests.CreateDataMapper(persistedFilePath)) { } Assert.IsTrue(true); // Constructor didn't throw. File.Delete(persistedFilePath); }
public override void Setup() { base.Setup(); _tempFolder = new TemporaryFolder(); _vernacularWritingSystem = WritingSystemDefinition.Parse(WritingSystemsIdsForTests.VernacularIdForTest); RtfRenderer.HeadWordWritingSystemId = _vernacularWritingSystem.Id; _filePath = _tempFolder.GetTemporaryFile(); _lexEntryRepository = new LexEntryRepository(_filePath); _analysisWritingSystemIds = new string[] { WritingSystemsIdsForTests.AnalysisIdForTest }; string[] vernacularWritingSystemIds = new string[] { _vernacularWritingSystem.Id }; ViewTemplate viewTemplate = new ViewTemplate(); viewTemplate.Add(new Field(Field.FieldNames.EntryLexicalForm.ToString(), "LexEntry", vernacularWritingSystemIds)); viewTemplate.Add(new Field("focusOnMe", "LexEntry", _analysisWritingSystemIds, Field.MultiplicityType.ZeroOr1, "MultiText")); viewTemplate.Add(new Field("MyEntryCustom", "LexEntry", _analysisWritingSystemIds, Field.MultiplicityType.ZeroOr1, "MultiText")); Field readOnlySemanticDomain = new Field(LexSense.WellKnownProperties.SemanticDomainDdp4, "LexSense", _analysisWritingSystemIds); readOnlySemanticDomain.Visibility = CommonEnumerations.VisibilitySetting.ReadOnly; viewTemplate.Add(readOnlySemanticDomain); Field shy1 = new Field("MyShyEntryCustom", "LexEntry", _analysisWritingSystemIds, Field.MultiplicityType.ZeroOr1, "MultiText"); shy1.Visibility = CommonEnumerations.VisibilitySetting.NormallyHidden; shy1.DisplayName = "MyShyEntryCustom"; viewTemplate.Add(shy1); #if GlossMeaning viewTemplate.Add(new Field(Field.FieldNames.SenseGloss.ToString(), "LexSense", analysisWritingSystemIds)); #else _definitionField = new Field(LexSense.WellKnownProperties.Definition, "LexSense", _analysisWritingSystemIds); viewTemplate.Add(_definitionField); #endif viewTemplate.Add(new Field("MySenseCustom", "LexSense", _analysisWritingSystemIds, Field.MultiplicityType.ZeroOr1, "MultiText")); viewTemplate.Add(new Field(Field.FieldNames.ExampleSentence.ToString(), "LexExampleSentence", vernacularWritingSystemIds)); viewTemplate.Add(new Field(Field.FieldNames.ExampleTranslation.ToString(), "LexExampleSentence", _analysisWritingSystemIds)); Field customField = new Field("SemanticDomains", "LexSense", _analysisWritingSystemIds, Field.MultiplicityType.ZeroOr1, "OptionCollection"); customField.DisplayName = "Sem Dom"; customField.OptionsListFile = "SemanticDomains.xml"; viewTemplate.Add(customField); Field customPOSField = new Field(LexSense.WellKnownProperties.PartOfSpeech, "LexSense", _analysisWritingSystemIds, Field.MultiplicityType.ZeroOr1, "Option"); customPOSField.DisplayName = "POS"; customPOSField.OptionsListFile = "PartsOfSpeech.xml"; viewTemplate.Add(customPOSField); Field customNotesField = new Field(PalasoDataObject.WellKnownProperties.Note, "LexSense", _analysisWritingSystemIds); customNotesField.DisplayName = "s-note"; viewTemplate.Add(customNotesField); Field exampleNotesField = new Field(PalasoDataObject.WellKnownProperties.Note, "LexExampleSentence", _analysisWritingSystemIds); exampleNotesField.DisplayName = "ex-note"; viewTemplate.Add(exampleNotesField); _entryViewFactory = (() => new EntryViewControl()); DictionaryControl.Factory dictControlFactory = (memory => new DictionaryControl(_entryViewFactory, _lexEntryRepository, viewTemplate, memory, new StringLogger())); _task = new DictionaryTask(dictControlFactory, DictionaryBrowseAndEditConfiguration.CreateForTests("definition"), _lexEntryRepository, new TaskMemoryRepository()); //, new UserSettingsForTask()); _detailTaskPage = new TabPage(); ActivateTask(); _tabControl = new TabControl(); _tabControl.Dock = DockStyle.Fill; _tabControl.TabPages.Add(_detailTaskPage); _tabControl.TabPages.Add(new TabPage("Dummy")); _window = new Form(); _window.Controls.Add(_tabControl); _window.Width = 700; _window.Height = 500; _window.Show(); }
public override void SetUp() { _tempFolder = new TemporaryFolder("LiftLexEntryRepositoryDeleteAllItemsTransitionTests"); _persistedFilePath = _tempFolder.GetTemporaryFile(); DataMapperUnderTest = new LiftLexEntryRepository(_persistedFilePath); }
public override void SetUp() { _tempFolder = new TemporaryFolder("LiftLexEntryRepositoryCreatedFromPersistedData"); _persistedFilePath = LiftFileInitializer.MakeFile(_tempFolder.GetTemporaryFile()); DataMapperUnderTest = new LiftLexEntryRepository(_persistedFilePath); }
public override void SetUp() { _tempFolder = new TemporaryFolder(); _persistedFilePath = _tempFolder.GetTemporaryFile(); DataMapperUnderTest = new LexEntryRepository(_persistedFilePath); }