public IEnumerable <FeatureTable> GetTables()
        {
            var diFrameworks = Frameworks.List().ToArray();
            var packages     = new Dictionary <IFrameworkAdapter, IPackage>();

            foreach (var diFramework in diFrameworks)
            {
                // special case, needed for MEF at least because it is a part of .NET framework:
                if (diFramework.FrameworkPackageId == null)
                {
                    continue;
                }

                var package = packageRepository.FindPackagesById(diFramework.FrameworkPackageId).SingleOrDefault();
                if (package == null)
                {
                    throw new InvalidOperationException("Package for '" + diFramework.FrameworkName + "' was not found in '" + this.packageRepository.Source + "'.");
                }

                packages.Add(diFramework, package);
            }

            yield return(GetGeneralInformation(diFrameworks, packages));

            yield return(GetNetVersionSupport(diFrameworks, packages));
        }
        public IEnumerable <FeatureTable> GetTables()
        {
            var testRuns   = this.runner.RunAllTests(typeof(BasicTests).Assembly).ToDictionary(r => new { Test = r.Method, r.FrameworkType });
            var testGroups = testRuns.Keys
                             .Select(k => k.Test)
                             .Distinct()
                             .GroupBy(m => m.DeclaringType)
                             .OrderBy(g => this.GetDisplayOrder(g.Key))
                             .ToArray();

            foreach (var group in testGroups)
            {
                var features = group.ToDictionary(m => m, this.ConvertToFeature);
                var table    = new FeatureTable(AttributeHelper.GetDisplayName(group.Key), Frameworks.List(), features.Values)
                {
                    Description = this.GetDescription(@group.Key),
                    Scoring     = AttributeHelper.GetScoring(@group.Key)
                };

                foreach (var test in group.OrderBy(this.GetDisplayOrder))
                {
                    foreach (var framework in Frameworks.List())
                    {
                        var cell = table[framework, test];
                        var run  = testRuns[new { Test = test, FrameworkType = framework.GetType() }];

                        ApplyRunResultToCell(cell, run);
                    }
                }

                yield return(table);
            }
        }
예제 #3
0
        // potentially I could have used Xunit runners, but they are a bit annoying to get through NuGet
        public IEnumerable <FeatureTestRun> RunAllTests(Assembly assembly)
        {
            var all = assembly.GetTypes()
                      .SelectMany(t => t.GetMethods())
                      .Where(m => m.IsDefined <FeatureAttribute>(false))
                      .ToArray();

            var runs           = new List <FeatureTestRun>();
            var frameworkTypes = Frameworks.List().Select(f => f.GetType()).ToArray();

            foreach (var test in all)
            {
                foreach (var frameworkType in frameworkTypes)
                {
                    // a bit stupid, but framework instances are not reusable between tests, and dependency aware
                    // run may need framework for each encountered dependency
                    Func <IFrameworkAdapter> newFramework = () => Frameworks.List().First(f => f.GetType() == frameworkType);
                    RunTestWithDependencyHandling(runs, test, newFramework, all);
                }
            }

            return(runs);
        }
예제 #4
0
 protected override IEnumerable <ITestCommand> EnumerateTestCommands(IMethodInfo method)
 {
     return(Frameworks.List().Select(adapter => new FeatureTestCommand(method, adapter)));
 }