コード例 #1
0
 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);
 }
コード例 #2
0
 public static void ShutdownTestEnvironment(LanguageDepotHelper languageDepot,
                                            MongoHelper mongo, WebworkHelper webwork)
 {
     mongo.Dispose();
     languageDepot.Dispose();
     webwork.Dispose();
     LfMergeHelper.Cleanup();
 }
コード例 #3
0
 public void RemoveNodeFromFile_NonexistingFileThrows()
 {
     using (var chorusHelper = new LanguageDepotHelper())
     {
         Assert.That(() => chorusHelper.RemoveNodeFromFile("NonExistingFile.txt", "/root", "File doesn't exist"),
                     Throws.TypeOf <FileNotFoundException>());
     }
 }
コード例 #4
0
        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"));
            }
        }
コード例 #5
0
        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"));
        }