Exemplo n.º 1
0
        public Task OnPackageValidationFinishedAsync(PackageValidationResult result, CancellationToken token)
        {
            _logger.LogInformation("Finished testing {PackageId} {PackageVersion}", result.Package.Id, result.Package.Version);
            var groupedResults = result.AggregateValidationResults.SelectMany(r => r.ValidationResults).GroupBy(r => r.Result);

            foreach (var resultsWithResult in groupedResults)
            {
                foreach (var validationResult in resultsWithResult)
                {
                    var testResultLogString = "{PackageId} {PackageVersion}: {ValidatorName}: {TestResult}";
                    var validatorName       = validationResult.Validator.GetType().Name;
                    var testResultString    = validationResult.Result.ToString();

                    switch (validationResult.Result)
                    {
                    case TestResult.Pass:
                    case TestResult.Skip:
                        _logger.LogInformation(testResultLogString, result.Package.Id, result.Package.Version, validatorName, testResultString);
                        break;

                    case TestResult.Fail:
                        _logger.LogError(LogEvents.ValidationFailed, validationResult.Exception, testResultLogString, result.Package.Id, result.Package.Version, validatorName, testResultString);
                        break;
                    }
                }
            }

            return(Task.FromResult(0));
        }
Exemplo n.º 2
0
 public PackageMonitoringStatus(FeedPackageIdentity package, PackageValidationResult validationResult, Exception validationException)
     : this()
 {
     Package             = package;
     ValidationResult    = validationResult;
     ValidationException = validationException;
 }
 public PackageMonitoringStatus(PackageValidationResult result)
 {
     ValidationResult = result ?? throw new ArgumentNullException(nameof(result));
     Package          = new FeedPackageIdentity(result.Package);
 }