public void Write_Tree() { var t = new global::GitSharp.Core.Tree(db); FileTreeEntry f = t.AddFile("i-am-a-file"); writeTrashFile(f.Name, "and this is the data in me\r\n\r\n"); Assert.AreEqual(File.ReadAllText("Resources/single_file_commit/i-am-a-file"), File.ReadAllText(db.WorkingDirectory.FullName + "/i-am-a-file")); t.Accept(new WriteTree(trash, db), TreeEntry.MODIFIED_ONLY); var id = t.Id; int git_w1; int git_w2; int w1; int w2; using (var b1 = new BinaryReader(new Inspector(db).ContentStream(id))) using (var b2 = new BinaryReader(Inspector.ContentStream("Resources/single_file_commit", "917c130bd4fa5bf2df0c399dc1b03401860aa448"))) { b1.BaseStream.Position = b1.BaseStream.Length - 21; b2.BaseStream.Position = b2.BaseStream.Length - 21; Assert.AreEqual(b2.ReadByte(), b1.ReadByte()); git_w1 = b2.ReadInt32(); git_w2 = b2.ReadInt32(); var git_w3 = b2.ReadInt32(); var git_w4 = b2.ReadInt32(); var git_w5 = b2.ReadInt32(); b2.BaseStream.Position = b2.BaseStream.Length - 20; var git_id = ObjectId.FromRaw(b2.ReadBytes(20)); w1 = b1.ReadInt32(); w2 = b1.ReadInt32(); } Assert.AreEqual(git_w1, w1); Assert.AreEqual(git_w2, w2); Assert.AreEqual("917c130bd4fa5bf2df0c399dc1b03401860aa448", id.Name); var s_git = Inspector.Inspect("Resources/single_file_commit", "917c130bd4fa5bf2df0c399dc1b03401860aa448"); var s = new Inspector(db).Inspect(id); Assert.AreEqual(s_git, s); }