Esempio n. 1
0
        public void testFileKeyOpenExisting()
        {
            Core.Repository r = new RepositoryCache.FileKey(db.Directory).open(true);

            Assert.IsNotNull(r);
            Assert.AreEqual(db.Directory.FullName, r.Directory.FullName);
            r.Close();

            r = new RepositoryCache.FileKey(db.Directory).open(false);

            Assert.IsNotNull(r);
            Assert.AreEqual(db.Directory.FullName, r.Directory.FullName);
            r.Close();
        }
Esempio n. 2
0
        public void testFileKeyOpenNew()
        {
            Core.Repository n = createBareRepository();

            DirectoryInfo gitdir = n.Directory;
            n.Close();
            recursiveDelete(gitdir);
            Assert.IsFalse(gitdir.Exists);

            var e =
                AssertHelper.Throws<RepositoryNotFoundException>(() => new RepositoryCache.FileKey(gitdir).open(true));
            Assert.AreEqual("repository not found: " + gitdir, e.Message);

            using (Core.Repository o = new RepositoryCache.FileKey(gitdir).open(false))
            {
                Assert.IsNotNull(o);
                Assert.AreEqual(gitdir.FullName, o.Directory.FullName);
                Assert.IsFalse(gitdir.Exists);
            }
        }
Esempio n. 3
0
        public void testFileKeyOpenNew()
        {
            DirectoryInfo gitdir;

            using (Repository n = createBareRepository())
            {
                gitdir = n.Directory;
            }

            recursiveDelete(gitdir);
            Assert.IsFalse(Directory.Exists(gitdir.FullName)); // changed from gitdir.Exist in order to work around a Mono bug (cf. DirectoryInfoExist() test method below).

            var e =
                AssertHelper.Throws<RepositoryNotFoundException>(() => new RepositoryCache.FileKey(gitdir).open(true));
            Assert.AreEqual("repository not found: " + gitdir, e.Message);

            using (Repository o = new RepositoryCache.FileKey(gitdir).open(false))
            {
                Assert.IsNotNull(o);
                Assert.AreEqual(gitdir.FullName, o.Directory.FullName);
                Assert.IsFalse(Directory.Exists(gitdir.FullName));  // changed from gitdir.Exist in order to work around a Mono bug (cf. DirectoryInfoExist() test method below).
            }
        }