Esempio n. 1
0
            public void ReturnsFalseWhenComparedToNull()
            {
                var edge = new CommitEdge(new CommitVertex("sha1-child", "child commit"),
                                          new CommitVertex("sha-parent", "parent commit"));

                Assert.False(edge.Equals(null));
            }
Esempio n. 2
0
            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);
            }
Esempio n. 3
0
            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));
            }
Esempio n. 4
0
            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);
            }
Esempio n. 5
0
            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);
            }
Esempio n. 6
0
            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));
            }
Esempio n. 7
0
            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);
            }
Esempio n. 8
0
            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);
            }
Esempio n. 9
0
            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);
            }
Esempio n. 10
0
            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);
            }
Esempio n. 11
0
            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));
            }
Esempio n. 12
0
        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);
            }
        }
Esempio n. 13
0
        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;
        }