示例#1
0
 public void RemoveOldLocks_WLockButNotRunningHg_LockRemoved()
 {
     using (var setup = new HgTestSetup())
     {
         var file = TempFileFromFolder.CreateAt(setup.Root.Combine(".hg", "wlock"), "blah");
         Assert.IsTrue(setup.Repository.RemoveOldLocks());
         Assert.IsFalse(File.Exists(file.Path));
     }
 }
示例#2
0
 public void RemoveOldLocks_WLockAndLockButNotRunningHg_BothLocksRemoved()
 {
     using (var setup = new HgTestSetup())
     {
         var file1 = TempFileFromFolder.CreateAt(setup.Root.Combine(".hg", "wlock"), "blah");
         var file2 = TempFileFromFolder.CreateAt(setup.Root.Combine(".hg", "store", "lock"), "blah");
         Assert.That(setup.Repository.RemoveOldLocks(), Is.True);
         Assert.That(File.Exists(file1.Path), Is.False);
         Assert.That(File.Exists(file2.Path), Is.False);
     }
 }
示例#3
0
 public GroupOfConflictFiles(string ancestor, string bob, string sally)
 {
     Folder = new TemporaryFolder("ChorusTest");
     // NB: ChorusNotesFileSyncTests::MergeConflictFiles_AncestorDidNotExist feeds an empty string for ancestor,
     // which is not valid in the Palaso CreateXmlFileWithContents method now.
     // So, we have to use the CreateAt method instead.
     AncestorFile = string.IsNullOrEmpty(ancestor)
                         ? TempFileFromFolder.CreateAt(Path.Combine(Folder.Path, "ancestor.lift.ChorusNotes"), ancestor)
                         : TempFileFromFolder.CreateXmlFileWithContents("ancestor.lift.ChorusNotes", Folder, ancestor);
     BobFile   = TempFileFromFolder.CreateXmlFileWithContents("bob.lift.ChorusNotes", Folder, bob);
     SallyFile = TempFileFromFolder.CreateXmlFileWithContents("sally.lift.ChorusNotes", Folder, sally);
 }
示例#4
0
        public void RemoveOldLocks_LockAndHgIsRunning_ReturnsFalse()
        {
            using (var setup = new HgTestSetup())
            {
                //we have to pretent to be hg
                var ourName = Process.GetCurrentProcess().ProcessName;

                using (var file = TempFileFromFolder.CreateAt(setup.Root.Combine(".hg", "store", "lock"), "blah"))
                {
                    Assert.IsFalse(setup.Repository.RemoveOldLocks(ourName, true));
                }
            }
        }
示例#5
0
 public void CorrectlyAppendsLdmlVersion3ToBranchName()
 {
     using (var liftProject = new TemporaryFolder("TempProj_LIFT"))
         using (var liftFile = new TempFileFromFolder(liftProject, "proj.lift", TestLift13File))
         {
             var wsDirectory = Directory.CreateDirectory(Path.Combine(Path.GetDirectoryName(liftFile.Path), "WritingSystems"));
             using (var writingSystemsDir =
                        TempFileFromFolder.CreateAt(liftProject.Combine("WritingSystems", "lang.ldml"), LdmlContentForTests.Version3("en", "", "", "")))
             {
                 var syncAdjunct = new LiftSynchronizerAdjunct(liftFile.Path);
                 Assert.AreEqual("LIFT0.13_ldml3", syncAdjunct.BranchName, "BranchName should be 'LIFT0.13_ldml3' with version 3 ldml files");
             }
         }
 }
示例#6
0
 public IDisposable GetLock()
 {
     return(TempFileFromFolder.CreateAt(Root.Combine(".hg", "store", "lock"), "blah"));
 }