public void ReturnsFalseWhenComparedToNull() { var edge = new CommitEdge(new CommitVertex("sha1-child", "child commit"), new CommitVertex("sha-parent", "parent commit")); Assert.False(edge.Equals(null)); }
public void ReturnsFalseWhenComparedToNull() { var edge = new CommitEdge(new CommitVertex("sha-child", "child commit"), new CommitVertex("sha-parent", "parent commit")); Assert.False(edge == null); Assert.True(edge != null); }
public void ReturnsFalseWhenComparedToNull() { var edge = new CommitEdge(new CommitVertex("sha1-child", "child commit"), new CommitVertex("sha-parent", "parent commit")); Assert.False(edge.Equals(null)); Assert.False(object.Equals(edge, null)); }
public void ReturnsTrueIfShaAreSame() { var edge = new CommitEdge(new CommitVertex("sha-child", "child commit"), new CommitVertex("sha-parent", "parent commit")); var other = new CommitEdge(new CommitVertex("sha-child", "another child commit"), new CommitVertex("sha-parent", "another parent commit")); Assert.True(edge == other); }
public void ReturnsFalseWhenNullAndComparedToNonNull() { CommitEdge edge = null; var other = new CommitEdge(new CommitVertex("sha-child", "child commit"), new CommitVertex("sha-parent", "parent commit")); Assert.False(edge == other); Assert.True(edge != other); }
public void ReturnsTrueIfSourceAndTargetAreSame() { var edge = new CommitEdge(new CommitVertex("sha-child", "child commit"), new CommitVertex("sha-parent", "parent commit")); var other = new CommitEdge(new CommitVertex("sha-child", "another child commit"), new CommitVertex("sha-parent", "another parent commit")); Assert.True(edge.Equals(other)); }
public void ReturnsFalseIfEitherShaIsDifferent() { var edge = new CommitEdge(new CommitVertex("sha-child", "child commit"), new CommitVertex("sha-parent", "parent commit")); var other = new CommitEdge(new CommitVertex("sha1-child", "another child commit"), new CommitVertex("sha-parent", "another parent commit")); Assert.False(edge == other); Assert.True(edge != other); }
public void ReturnsFalseIfSourceAndTargetAreSame() { var edge = new CommitEdge(new CommitVertex("sha1-child", "child commit"), new CommitVertex("sha-parent", "parent commit")); var other = new CommitEdge(new CommitVertex("sha-child", "another child commit"), new CommitVertex("sha-parent", "another parent commit")); Assert.False(edge.Equals(other)); Assert.False(object.Equals(edge, other)); }
private void AddCommitsToGraph(Commit commit, CommitVertex childVertex) { var commitVertex = GetCommitVertex(commit); _graph.AddVertex(commitVertex); if (childVertex != null) { var edge = new CommitEdge(childVertex, commitVertex); if (!_edges.ContainsKey(edge.Id)) { _graph.AddEdge(edge); _edges.Add(edge.Id, edge); } } foreach (var parent in commit.Parents) { AddCommitsToGraph(parent, commitVertex); } }
private bool AddCommitToGraph(Commit commit, CommitVertex childVertex) { var commitVertex = GetCommitVertex(commit); _graph.AddVertex(commitVertex); if (childVertex != null) { var edge = new CommitEdge(childVertex, commitVertex); if (_edges.ContainsKey(edge.Id)) return false; _graph.AddEdge(edge); _edges.Add(edge.Id, edge); } return true; }