Example #1
0
        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 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);
        }
Example #3
0
 public void Setup()
 {
     WeSayProjectTestHelper.InitializeForTests();
     _destinationZip    = Path.Combine(Path.GetTempPath(), Path.GetTempFileName() + ".zip");
     _sourceProjectPath = BasilProject.GetPretendProjectDirectory();
     _backupMaker       = new BackupMaker();
     _filesToBackup     = WeSayWordsProject.GetFilesBelongingToProject(_sourceProjectPath);
 }
Example #4
0
        public void Setup()
        {
            WeSayProjectTestHelper.InitializeForTests();
            _filePath           = Path.GetTempFileName();
            _liftFilePath       = Path.GetTempFileName();
            _lexEntryRepository = new LexEntryRepository(_filePath);

            _addin = new HtmlTransformer();
            _addin.LaunchAfterTransform = false;
        }
Example #5
0
        public void MigrateIfNeeded_AfterMigrationTheNewConfigFileIsLoaded()
        {
            WeSayProjectTestHelper.InitializeForTests();
            string pathToConfigFile = Path.GetTempFileName();

            File.WriteAllText(pathToConfigFile,
                              GetV7ConfigFileContent());
            var configFile = new ConfigFile(pathToConfigFile);

            configFile.MigrateIfNecassary();
            Assert.That(configFile.Version, Is.EqualTo(ConfigFile.LatestVersion));
        }
        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());
        }
Example #7
0
        public void ChangeWritingSystemId_DoesnotExist_NoChange()
        {
            WeSayProjectTestHelper.InitializeForTests();
            string pathToConfigFile = Path.GetTempFileName();

            File.WriteAllText(pathToConfigFile,
                              GetV7ConfigFileContent());
            var configFile = new ConfigFile(pathToConfigFile);

            configFile.ReplaceWritingSystemId("hi-up", "hi-Zxxx-x-audio");
            string newFileContent = File.ReadAllText(pathToConfigFile);

            Assert.IsFalse(newFileContent.Contains("hi-Zxxx-x-audio"));
        }
Example #8
0
        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()
        {
            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);
        }
Example #10
0
        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);
        }
Example #11
0
        public void Setup()
        {
            WeSayProjectTestHelper.InitializeForTests();
            var b = new ContainerBuilder();

            b.Register(c => new MediaNamingHelper(new string[] { "en" }));
            b.Register <IWeSayTextBox>(c =>
            {
                var m = new WeSayTextBox();
                return(m);
            });
            b.Register <IWeSayComboBox>(c =>
            {
                var m = new WeSayComboBox();
                return(m);
            });
            b.Register <IWeSayListView>(c =>
            {
                var m = new WeSayListView();
                return(m);
            });
            Context = new WeSay.Project.ServiceLocatorAdapter(b.Build());
        }
Example #12
0
 public void Setup()
 {
     WeSayProjectTestHelper.InitializeForTests();
     _addin = new SfmTransformer();
     _addin.LaunchAfterTransform = false;
 }
Example #13
0
 public void SetupFixture()
 {
     Palaso.UI.WindowsForms.Keyboarding.KeyboardController.Initialize();
     _project = WeSayProjectTestHelper.InitializeForTests();
 }
Example #14
0
 public void RunAndExitWithoutOpening()
 {
     _mainWindowTester.Close();
     WeSayProjectTestHelper.InitializeForTests();             // for Teardown
 }