예제 #1
0
 public void RemoveNodeFromFile_NonexistingFileThrows()
 {
     using (var chorusHelper = new LanguageDepotHelper())
     {
         Assert.That(() => chorusHelper.RemoveNodeFromFile("NonExistingFile.txt", "/root", "File doesn't exist"),
                     Throws.TypeOf <FileNotFoundException>());
     }
 }
예제 #2
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"));
            }
        }