public static void InitializeTestEnvironment(out LanguageDepotHelper languageDepot, out MongoHelper mongo, out WebworkHelper webwork) { languageDepot = new LanguageDepotHelper(); mongo = new MongoHelper($"sf_{Settings.DbName}"); webwork = new WebworkHelper(Settings.DbName); }
public static void ShutdownTestEnvironment(LanguageDepotHelper languageDepot, MongoHelper mongo, WebworkHelper webwork) { mongo.Dispose(); languageDepot.Dispose(); webwork.Dispose(); LfMergeHelper.Cleanup(); }
public void RemoveNodeFromFile_NonexistingFileThrows() { using (var chorusHelper = new LanguageDepotHelper()) { Assert.That(() => chorusHelper.RemoveNodeFromFile("NonExistingFile.txt", "/root", "File doesn't exist"), Throws.TypeOf <FileNotFoundException>()); } }
public void RemoveNodeFromFile_RemovesNodeAndAmendsTip() { using (var chorusHelper = new LanguageDepotHelper()) { chorusHelper.ApplyPatches(Settings.MaxModelVersion, 6); var prevTip = GetTipRevision(_repoDir); // SUT chorusHelper.RemoveNodeFromFile("Lexicon.fwstub.ChorusNotes", "/notes/annotation[message='Comment on word B']", "Remove note for B"); // Verify Assert.That(GetTipRevision(_repoDir), Is.EqualTo(prevTip)); var notes = File.ReadAllText(Path.Combine(Settings.TempDir, "LanguageDepot", "Lexicon.fwstub.ChorusNotes")); Assert.That(notes, Is.StringContaining("FW comment on word A")); Assert.That(notes, Is.Not.StringContaining("Comment on word B")); } }
public void FindXmlFile() { // Setup Settings.DataDirName = "comments-data"; Settings.DbName = "test-comment-sr"; var languageDepot = new LanguageDepotHelper(); languageDepot.ApplyPatches(Settings.MinModelVersion, 2); var sut = new VerifyLanguageDepotSpy(); // Exercise VerifyLanguageDepot.AssertFilesContain(XElement.Parse(@" <root> <Lexicon> <LexEntry> <LexemeForm> <MoStemAllomorph> <Form> <AUni ws=""fr"">A</AUni> </Form> </MoStemAllomorph> </LexemeForm> <Senses> <ownseq> <Definition expectAbsence=""true"" /> <Gloss> <AUni ws=""en"">A</AUni> </Gloss> </ownseq> </Senses> </LexEntry> </Lexicon> </root>" )); // Verify Assert.That(Path.GetFileName(sut.XmlFile), Is.EqualTo("Lexicon_07.lexdb")); }