Example #1
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);
        }
Example #2
0
 private IEnumerable <TestEntry> BuildEntriesFor(AffectedGraph graph)
 {
     InvokeMinimizerMessage(MessageType.Info, "there are " + graph.AllNodes().Count() + "in the graph.");
     foreach (var n in graph.AllNodes())
     {
         if (n.TestDescriptors == null)
         {
             continue;
         }
         foreach (var desc in n.TestDescriptors)
         {
             yield return(new TestEntry
             {
                 TestAssembly = n.Assembly,
                 TestClass = n.Type,
                 TestName = desc.Target,
                 TestRunners = new List <string> {
                     desc.TestRunner
                 }
             });
         }
     }
 }
 public void EnrichGraph(AffectedGraph graph)
 {
     foreach (var node in graph.AllNodes())
     {
         var cachenode = TryGetEfferentCouplingNode(node.FullName.Replace('+', '/'));
         if (cachenode != null)
         {
             var r = cachenode.MemberReference;
             if (r != null)
             {
                 node.DisplayName = r.DeclaringType.Name + "::" + r.Name;
                 node.Assembly    = r.Module.Assembly.FullName;
                 node.IsInterface = r.DeclaringType.ThreadSafeResolve().IsInterface;
             }
             node.Profiled = true;
             node.IsTest   = _testIdentifiers.IsTest(cachenode.MemberReference);
         }
     }
 }
Example #4
0
 static IEnumerable <TestDescriptor> GetTestsInGraph(AffectedGraph graph)
 {
     return(graph.AllNodes().Where(entry => entry.IsTest).SelectMany(entry => entry.TestDescriptors));
 }