Esempio n. 1
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"));
            }
        }
Esempio n. 2
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"));
        }