public virtual void TestReadIndex_DirCacheTree()
        {
            IDictionary <string, DirCacheCGitCompatabilityTest.CGitIndexRecord> cList = ReadLsFiles
                                                                                            ();
            IDictionary <string, DirCacheCGitCompatabilityTest.CGitLsTreeRecord> cTree = ReadLsTree
                                                                                             ();
            DirCache dc = new DirCache(index, FS.DETECTED);

            NUnit.Framework.Assert.AreEqual(0, dc.GetEntryCount());
            dc.Read();
            NUnit.Framework.Assert.AreEqual(cList.Count, dc.GetEntryCount());
            DirCacheTree jTree = dc.GetCacheTree(false);

            NUnit.Framework.Assert.IsNotNull(jTree);
            NUnit.Framework.Assert.AreEqual(string.Empty, jTree.GetNameString());
            NUnit.Framework.Assert.AreEqual(string.Empty, jTree.GetPathString());
            NUnit.Framework.Assert.IsTrue(jTree.IsValid());
            NUnit.Framework.Assert.AreEqual(ObjectId.FromString("698dd0b8d0c299f080559a1cffc7fe029479a408"
                                                                ), jTree.GetObjectId());
            NUnit.Framework.Assert.AreEqual(cList.Count, jTree.GetEntrySpan());
            AList <DirCacheCGitCompatabilityTest.CGitLsTreeRecord> subtrees = new AList <DirCacheCGitCompatabilityTest.CGitLsTreeRecord
                                                                                         >();

            foreach (DirCacheCGitCompatabilityTest.CGitLsTreeRecord r in cTree.Values)
            {
                if (FileMode.TREE.Equals(r.mode))
                {
                    subtrees.AddItem(r);
                }
            }
            NUnit.Framework.Assert.AreEqual(subtrees.Count, jTree.GetChildCount());
            for (int i = 0; i < jTree.GetChildCount(); i++)
            {
                DirCacheTree sj = jTree.GetChild(i);
                DirCacheCGitCompatabilityTest.CGitLsTreeRecord sc = subtrees[i];
                NUnit.Framework.Assert.AreEqual(sc.path, sj.GetNameString());
                NUnit.Framework.Assert.AreEqual(sc.path + "/", sj.GetPathString());
                NUnit.Framework.Assert.IsTrue(sj.IsValid());
                NUnit.Framework.Assert.AreEqual(sc.id, sj.GetObjectId());
            }
        }
        /// <exception cref="System.Exception"></exception>
        private IDictionary <string, DirCacheCGitCompatabilityTest.CGitLsTreeRecord> ReadLsTree
            ()
        {
            LinkedHashMap <string, DirCacheCGitCompatabilityTest.CGitLsTreeRecord> r = new LinkedHashMap
                                                                                       <string, DirCacheCGitCompatabilityTest.CGitLsTreeRecord>();
            BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(
                                                                             PathOf("gitgit.lstree")), "UTF-8"));

            try
            {
                string line;
                while ((line = br.ReadLine()) != null)
                {
                    DirCacheCGitCompatabilityTest.CGitLsTreeRecord cr = new DirCacheCGitCompatabilityTest.CGitLsTreeRecord
                                                                            (line);
                    r.Put(cr.path, cr);
                }
            }
            finally
            {
                br.Close();
            }
            return(r);
        }
		/// <exception cref="System.Exception"></exception>
		private IDictionary<string, DirCacheCGitCompatabilityTest.CGitLsTreeRecord> ReadLsTree
			()
		{
			LinkedHashMap<string, DirCacheCGitCompatabilityTest.CGitLsTreeRecord> r = new LinkedHashMap
				<string, DirCacheCGitCompatabilityTest.CGitLsTreeRecord>();
			BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(
				PathOf("gitgit.lstree")), "UTF-8"));
			try
			{
				string line;
				while ((line = br.ReadLine()) != null)
				{
					DirCacheCGitCompatabilityTest.CGitLsTreeRecord cr = new DirCacheCGitCompatabilityTest.CGitLsTreeRecord
						(line);
					r.Put(cr.path, cr);
				}
			}
			finally
			{
				br.Close();
			}
			return r;
		}