private async Task ApplyRunResultToCell(FeatureCell cell, Task <FeatureTestResult> resultTask) { var result = await resultTask; if (result.Kind == FeatureTestResultKind.Success) { cell.DisplayValue = "pass"; cell.State = FeatureState.Success; cell.Details = result.Message; } else if (result.Kind == FeatureTestResultKind.Failure) { var exceptionString = this.RemoveLocalPaths(result.Exception.ToString()); cell.DisplayValue = "fail"; cell.State = FeatureState.Failure; cell.Details = exceptionString; cell.RawError = exceptionString; } else if (result.Kind == FeatureTestResultKind.SkippedDueToDependency) { cell.DisplayValue = "n/a"; cell.State = FeatureState.Skipped; cell.Details = result.Message; } else { cell.DisplayValue = "note"; cell.State = FeatureState.Concern; cell.Details = result.Message; } }
private async Task FillLicense(FeatureCell cell, IPackage package) { if (package == null || package.LicenseUrl == null) { FillWithNA(cell); return; } cell.DisplayUri = package.LicenseUrl; LicenseInfo licenseInfo = null; try { licenseInfo = await this.licenseResolver.GetLicenseInfo(package.LicenseUrl); } catch (HttpDataRequestException ex) { cell.State = FeatureState.Neutral; cell.DisplayValue = ((int)ex.StatusCode).ToString(); return; } if (licenseInfo == null) { cell.State = FeatureState.Neutral; cell.DisplayValue = "unrecognized"; return; } cell.DisplayValue = licenseInfo.ShortName; }
private async Task ApplyRunResultToCell(FeatureCell cell, Task <FeatureTestResult> resultTask, Assembly testAssembly) { var result = await resultTask; if (result.Kind == FeatureTestResultKind.Success) { cell.DisplayValue = "pass"; cell.State = FeatureState.Success; cell.Details = result.Message; } else if (result.Kind == FeatureTestResultKind.Failure) { var exceptionString = this.exceptionNormalizer.Normalize(result.Exception, testAssembly); cell.DisplayValue = "fail"; cell.State = FeatureState.Failure; cell.Details = ConvertExceptionToMarkdown(exceptionString); cell.RawError = exceptionString; } else if (result.Kind == FeatureTestResultKind.SkippedDueToDependency) { cell.DisplayValue = "n/a"; cell.State = FeatureState.Skipped; cell.Details = result.Message; } else { cell.DisplayValue = "note"; cell.State = FeatureState.Concern; cell.Details = result.Message; } }
private void ApplyRunResultToCell(FeatureCell cell, FeatureTestRun run) { if (run.Result == FeatureTestResult.Success) { cell.DisplayText = "supported"; cell.State = FeatureState.Success; } else if (run.Result == FeatureTestResult.Failure) { cell.DisplayText = "failed"; cell.State = FeatureState.Failure; var exceptionString = RemoveLocalPaths(run.Exception.ToString()); cell.RawError = exceptionString; cell.DisplayUri = ConvertToDataUri(exceptionString); } else if (run.Result == FeatureTestResult.SkippedDueToDependency) { cell.DisplayText = "skipped"; cell.State = FeatureState.Skipped; } else { cell.DisplayText = "see comment"; cell.State = FeatureState.Concern; } cell.Comment = run.Message; }
private KeyValuePair <string, object> GetSingleFeatureData(Feature feature, FeatureCell cell) { var key = this.GetFeatureName(feature); var value = new { result = cell.State.ToString().ToLowerInvariant(), comment = cell.Details, error = cell.RawError }; return(new KeyValuePair <string, object>(key, value)); }
private void FillUrl(FeatureCell cell, IPackage package) { if (package == null || package.ProjectUrl == null) { FillWithNA(cell); return; } cell.State = FeatureState.Neutral; cell.DisplayValue = "link"; cell.DisplayUri = package.ProjectUrl; }
private async Task FillDataFromNuGetGallery(FeatureCell releasedCell, FeatureCell downloadsCell, IPackage localPackage) { if (localPackage == null) // this is always intentional { FillWithNA(releasedCell); FillWithNA(downloadsCell); return; } var remoteQueryUrl = new Uri(string.Format("http://nuget.org/api/v2/Packages(Id='{0}',Version='{1}')", localPackage.Id, localPackage.Version)); var remotePackageXml = XDocument.Parse(await this.dataProvider.GetStringAsync(remoteQueryUrl)); releasedCell.DisplayValue = GetFromNuGetGalleryResult <DateTimeOffset>(remotePackageXml, "Published"); downloadsCell.DisplayValue = GetFromNuGetGalleryResult <int>(remotePackageXml, "DownloadCount"); }
public string GetCssClassesForCell(FeatureCell cell) { var classes = cell.State.ToString().ToLowerInvariant(); if (cell.DisplayValue is int) { classes += " number"; } if (cell.DisplayValue is DateTimeOffset) { classes += " date"; } return(classes); }
private void FillDistribution(FeatureCell cell, ILibrary library, IPackage package) { if (package == null) { cell.DisplayValue = "built-in"; return; } if (library.Assembly == null) { cell.State = FeatureState.Concern; cell.DisplayValue = "source"; return; } cell.DisplayValue = "binary"; }
private static void FillUrl(FeatureCell cell, IPackage package) { if (package == null) // this is always intentional { cell.State = FeatureState.Skipped; cell.DisplayText = "n/a"; return; } if (package.ProjectUrl == null) { cell.State = FeatureState.Concern; cell.DisplayText = "unknown"; return; } cell.State = FeatureState.Neutral; cell.DisplayText = "link"; cell.DisplayUri = package.ProjectUrl; }
private void FillUrl(FeatureCell cell, ILibrary library) { if (library.PackageId == null) { // this is always intentional FillWithNA(cell); return; } var package = this.packageCache.GetPackage(library.PackageId); if (package.ProjectUrl == null) { FillWithNA(cell); return; } cell.State = FeatureState.Neutral; cell.DisplayValue = "link"; cell.DisplayUri = package.ProjectUrl; }
private static void FillWithNA(FeatureCell cell) { cell.State = FeatureState.Skipped; cell.DisplayValue = "n/a"; }
private static void FillVersion(FeatureCell cell, ILibrary library, IPackage package) { cell.DisplayValue = package != null?package.Version.ToString() : library.Assembly.GetName().Version.ToString(); }