Esempio n. 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);
        }
Esempio n. 2
0
        public AffectedGraph GetCouplingGraphFor(string cacheName)
        {
            var            affected            = new List <ChangeContext>();
            var            graph               = new AffectedGraph();
            var            forwardCutOffPoints = new Dictionary <string, bool>();
            var            backCutOffPoints    = new Dictionary <string, bool>();
            TypeDefinition scope               = null;

            GetEfferentGraph(null, cacheName, forwardCutOffPoints, affected, graph, true, scope);
            WriteWalkerDebug("got " + affected + " nodes for " + cacheName, 0);
            var rets = affected.ForkAndJoinTo(_numthreads, x =>
            {
                FillAfferentGraph(x.Member, backCutOffPoints, graph, null, 0, null, false, new List <string>(), GenericContext.Empty(), false); //gets all tests Ca
                return(true);
            });

            return(graph);
        }