public void testCacheOpen() { RepositoryCache.FileKey loc = RepositoryCache.FileKey.exact(db.Directory); Core.Repository d2 = RepositoryCache.open(loc); Assert.AreNotSame(db, d2); Assert.AreSame(d2, RepositoryCache.open(RepositoryCache.FileKey.exact(loc.getFile()))); d2.Close(); d2.Close(); }
public void testCacheRegisterOpen() { DirectoryInfo dir = db.Directory; RepositoryCache.register(db); using (Core.Repository exact = RepositoryCache.open(RepositoryCache.FileKey.exact(dir))) { Assert.AreSame(db, exact); } Assert.IsTrue(dir.Name.EndsWith(Constants.DOT_GIT_EXT)); Assert.AreEqual(Constants.DOT_GIT, dir.Name); DirectoryInfo parent = dir.Parent; using (Core.Repository lenient = RepositoryCache.open(RepositoryCache.FileKey.lenient(parent))) { Assert.AreSame(db, lenient); } RepositoryCache.close(db); }