public virtual void TestEmptyCache_Clear_NoCacheTree()
        {
            DirCache     dc   = db.ReadDirCache();
            DirCacheTree tree = dc.GetCacheTree(true);

            NUnit.Framework.Assert.IsNotNull(tree);
            dc.Clear();
            NUnit.Framework.Assert.IsNull(dc.GetCacheTree(false));
            NUnit.Framework.Assert.AreNotSame(tree, dc.GetCacheTree(true));
        }
예제 #2
0
        public virtual void TestBuildThenClear()
        {
            DirCache dc = db.ReadDirCache();

            string[]        paths = new string[] { "a.", "a.b", "a/b", "a0b" };
            DirCacheEntry[] ents  = new DirCacheEntry[paths.Length];
            for (int i = 0; i < paths.Length; i++)
            {
                ents[i]          = new DirCacheEntry(paths[i]);
                ents[i].FileMode = FileMode.REGULAR_FILE;
            }
            DirCacheBuilder b = dc.Builder();

            for (int i_1 = 0; i_1 < ents.Length; i_1++)
            {
                b.Add(ents[i_1]);
            }
            b.Finish();
            NUnit.Framework.Assert.IsFalse(dc.HasUnmergedPaths());
            NUnit.Framework.Assert.AreEqual(paths.Length, dc.GetEntryCount());
            dc.Clear();
            NUnit.Framework.Assert.AreEqual(0, dc.GetEntryCount());
            NUnit.Framework.Assert.IsFalse(dc.HasUnmergedPaths());
        }