public void RepositoryBranch_Test_EmtyBranch_HasEmptyHistory() { var repository = new RepositoryBranch <string, string>(); Assert.That(repository.Head == null); Assert.That(repository.GetHistory().Count() == 0, "Empty repository should have zero length history"); }
public void RepositoryBranch_Test_CommitOperation() { var repository = new RepositoryBranch <string, string>(); Assert.That(repository.Head == null); var commit = repository.Commit(string.Empty, string.Empty); Assert.That(repository.Head.Equals(commit), "Repo should poit to the last commit"); Assert.That(commit.Previous == null, "First commit should not have any parents"); var commit2 = repository.Commit("other", string.Empty); Assert.That(repository.Head.Equals(commit2), "Repo should poit to the last commit"); Assert.That(commit2.Previous != null, "New commit should point to previous one"); Assert.That(commit2.Previous.Equals(commit), "New commit should point to previous one"); Assert.That(repository.GetHistory().Count() == 2, "Repository should contains exactly two commits at this point"); Assert.That(repository.GetHistory().First().Equals(commit2), "History should starts from last commit"); }