public void Combine(DependencyGraph dependencyGraph) { foreach (KeyValuePair<Id, IEnumerable<Id>> dependency in dependencyGraph.dependencies) { this.dependencies[dependency.Key] = dependency.Value; } }
public void GetCycles_returns_Indirect_Cycle() { var graph = new DependencyGraph(); var id1 = new Id("1", new AST.PositionInText()); var id2 = new Id("2", new AST.PositionInText()); var id3 = new Id("3", new AST.PositionInText()); graph.AddNewDirectDepencencies(id1, new List<Id> { id2 }); graph.AddNewDirectDepencencies(id2, new List<Id> { id3 }); graph.AddNewDirectDepencencies(id3, new List<Id> { id1 }); Assert.IsTrue(graph.GetCycles().ToList().Count == 3); }