public GitObject CreateFromContent(GitObjectStream content) { string type = ReadHeading(content); GitObject obj; if (type == "commit") obj = new Commit(); else if (type == "tree") obj = new Tree(); else if (type == "blob") obj = new Blob(); else throw new NotImplementedException("Support for file type is not implemented."); content.Rewind(); obj.Load(content); return obj; }
public void ParsesCommitter() { var factory = new ObjectFactory(); var commit = factory.CreateFromContent(CommitContent) as Commit; Assert.That(commit.Committer, Is.EqualTo("James Gregory <*****@*****.**>")); }