public void empty_graphs_merge_to_empty_graph()
 {
     var graph1 = new AffectedGraph();
     var graph2 = new AffectedGraph();
     var merged = graph1.Merge(graph2);
     Assert.AreEqual(0, merged.AllNodes().Count());
 }
Ejemplo n.º 2
0
 public AffectedGraph GetAffectedGraphForChangeSet(IEnumerable<Change<MethodReference>> changes)
 {
     InvokeMinimizerMessage(MessageType.Debug, "getting tests for changes");
     var start = DateTime.Now;
     var graph = new AffectedGraph();
     var breadCrumbs = new Dictionary<string, bool>();
     var affectedItems = GetAffectedItems(changes, graph);
     var rets = affectedItems.ForkAndJoinTo(_numthreads, x =>
                                                             {
                                                                 var tmp = new AffectedGraph();
                                                                 FillAfferentGraph(x.Member, breadCrumbs,
                                                                                   tmp, null, 0, null, false,
                                                                                   new List<string>(),
                                                                                   GenericContext.Empty(), false);
                                                                 return tmp;
                                                             });
     InvokeMinimizerMessage(MessageType.Debug, "there are " + rets.Count() + " graphs returned. Combining.");
     foreach(var g in rets)
     {
         if (g != null)
         {
             InvokeMinimizerMessage(MessageType.Debug,
                                    "there are " + g.AllNodes().Count() + " Nodes in graph. TOTAL=" +
                                    graph.AllNodes().Count());
             graph = graph.Merge(g);
         }
     }
     InvokeMinimizerMessage(MessageType.Debug, "there are " + rets.Count() + " nodes in combined graph."); 
     var end = DateTime.Now;
     InvokeMinimizerMessage(MessageType.Debug, "took " + (end - start) + " to walk graph");
     return graph;
 }
 public void nodes_from_both_graphs_get_added_to_output()
 {
     var graph1 = new AffectedGraph();
     graph1.AddNode(new AffectedGraphNode("test1", false, false, false, "test", "test12", "assembly", "type", new List<TestDescriptor>(), false, false, 0));
     var graph2 = new AffectedGraph();
     graph2.AddNode(new AffectedGraphNode("test1", false, false, false, "test", "test123", "assembly", "type", new List<TestDescriptor>(), false, false, 0));
     var merged = graph1.Merge(graph2);
     Assert.AreEqual(2, merged.AllNodes().Count());
 }