コード例 #1
0
ファイル: TestExtenderGraph.cs プロジェクト: dotnet/wpf-test
        ///<summary>
        ///</summary>
        public TestExtenderOutput Generate(int rootIndex)
        {
            TestExtenderOutput txro = new TestExtenderOutput();

            Stopwatch timer = Stopwatch.StartNew();

            CalculateDependenciesAndRoots();

            if (rootIndex >= this.Generators.Count || rootIndex < 0)
            {
                throw new ArgumentOutOfRangeException("rootIndex");
            }

            IVariationGenerator vg = this.RootGenerators[rootIndex];

            foreach (VariationItem item in vg.Generate())
            {
                item.IsRoot = true;
                txro.TestCases.Add(item);
            }

            timer.Stop();
            GlobalLog.LogDebug("Generation Time " + rootIndex.ToString() + " : " + timer.Elapsed.TotalSeconds.ToString());

            return(txro);
        }
コード例 #2
0
        public static string GetVariationsString(this IVariationGenerator variationGenerator)
        {
            if (variationGenerator == null)
            {
                throw new ArgumentNullException(nameof(variationGenerator), "Generator is null");
            }

            if (variationGenerator.LoopCount > ushort.MaxValue)
            {
                throw new Exception($"Can't generate too many variations into memory: {variationGenerator.LoopCount:N0}");
            }

            var result = new StringBuilder((int)variationGenerator.LoopCount);

            foreach (var variation in variationGenerator.GetVariations())
            {
                result.AppendLine(variation);
            }
            return(result.ToString());
        }
コード例 #3
0
ファイル: TestExtenderGraph.cs プロジェクト: dotnet/wpf-test
        private static void FindAndRemoveFalseRoots(IVariationGeneratorCollection possibleRoots, IVariationGenerator vg)
        {
            foreach (IVariationGenerator childVG in vg.Dependencies)
            {
                if (possibleRoots.Contains(childVG))
                {
                    possibleRoots.Remove(childVG);
                }

                FindAndRemoveFalseRoots(possibleRoots, childVG);
            }
        }