private FeatureTable GetTable(Assembly featureTestAssembly) { var libraries = LibraryProvider.GetAdapters(featureTestAssembly).ToArray(); var allVersionsGrouped = libraries.Where(l => l.PackageId != null) .Select(l => this.packageCache.GetPackage(l.PackageId)) .SelectMany(p => p.GetSupportedFrameworks()) .SelectMany(NetFxVersionHelper.Split) .Where(NetFxVersionHelper.ShouldDisplay) .GroupBy(NetFxVersionHelper.GetDisplayName) .OrderBy(g => NetFxVersionHelper.GetDisplayOrder(g.First())) .ToList(); var versionFeatures = allVersionsGrouped.Select(g => new Feature(g, g.Key)); var table = new FeatureTable(MetadataKeys.NetFxSupportTable, "Supported .NET versions", libraries, versionFeatures) { Description = "This information is based on versions included in NuGet package.", Scoring = FeatureScoring.NotScored }; foreach (var library in libraries) { this.FillNetVersionSupport(table, library, allVersionsGrouped); } return(table); }
private FeatureTable GetTable(Assembly featureTestAssembly) { var version = new Feature(MetadataKeys.VersionFeature, "Version") { Description = "Not necessarily the latest version, but the one we are testing." }; var released = new Feature("Released"); var distribution = new Feature("Distribution"); var url = new Feature(MetadataKeys.UrlFeature, "Web Site"); var license = new Feature("License"); var downloads = new Feature("Downloads") { Description = "Total downloads of the NuGet package." }; var total = new Feature(MetadataKeys.TotalFeature, "Total Score") { Description = "Total Score is based on total amount of feature tests passed." + Environment.NewLine + Environment.NewLine + "Most tables give one point per success, but some (such as List support) give one point per table. " + Environment.NewLine + Environment.NewLine + "The score is only for quick comparison, please read individual tables for the details." }; var features = new[] { version, released, distribution, url, license, downloads, total }; var libraries = LibraryProvider.GetAdapters(featureTestAssembly).ToArray(); var table = new FeatureTable(MetadataKeys.GeneralInfoTable, @"General information", libraries, features) { Scoring = FeatureScoring.NotScored }; var tasks = new List <Task>(); foreach (var library in libraries) { var package = library.PackageId != null?this.packageCache.GetPackage(library.PackageId) : null; FillVersion(table[library, version], library, package); FillDistribution(table[library, distribution], library, package); FillUrl(table[library, url], package); tasks.Add(FillLicense(table[library, license], package)); tasks.Add(FillDataFromNuGetGallery(table[library, released], table[library, downloads], package)); } Task.WaitAll(tasks.ToArray()); return(table); }
public IEnumerable <FeatureTable> GetTables(Assembly featureTestAssembly) { var testRuns = this.runner.RunAllTests(featureTestAssembly).ToDictionary(r => new { Test = r.Method, LibraryType = r.AdapterType }); var testGroups = testRuns.Keys .Select(k => k.Test) .Distinct() .GroupBy(m => m.DeclaringType) .OrderBy(g => FeatureTestAttributeHelper.GetDisplayOrder(g.Key)) .ToArray(); var libraries = LibraryProvider.GetAdapters(featureTestAssembly).ToArray(); foreach (var group in testGroups) { var features = group.ToDictionary(m => m, this.ConvertToFeature); var table = new FeatureTable(FeatureTestAttributeHelper.GetDisplayName(group.Key), libraries, features.Values) { Description = this.GetDescription(@group.Key), Scoring = FeatureTestAttributeHelper.GetScoring(@group.Key) }; var resultApplyTasks = new List <Task>(); foreach (var test in group.OrderBy(FeatureTestAttributeHelper.GetDisplayOrder)) { foreach (var library in libraries) { var cell = table[library, test]; var run = testRuns[new { Test = test, LibraryType = library.GetType() }]; resultApplyTasks.Add(this.ApplyRunResultToCell(cell, run.Task)); } } Task.WaitAll(resultApplyTasks.ToArray()); yield return(table); } }
protected override IEnumerable <ITestCommand> EnumerateTestCommands(IMethodInfo method) { return(LibraryProvider.GetAdapters(method.Class.Type.Assembly) .Select(adapter => new FeatureTestCommand(method, adapter))); }