public FactsBase()
            {
                _callbackUrl        = new Uri("http://example/callback");
                _packageUrlTemplate = "http://example/packages/{id}/{version}/{id}.{version}.nupkg";
                _scanningService    = new Mock <IVirusScanningService>();
                _logger             = new Mock <ILogger <VcsValidator> >();

                _message = new PackageValidationMessage
                {
                    PackageId      = "NuGet.Versioning",
                    PackageVersion = "3.4.0-ALPHA",
                    ValidationId   = new Guid("f470b9fb-0243-4f65-8aef-90d93dfe1a03"),
                    Package        = new NuGetPackage
                    {
                        Id = "NuGet.Versioning",
                        NormalizedVersion = "3.4.0-ALPHA"
                    }
                };
                _auditEntries = new List <PackageValidationAuditEntry>();
                _virusScanJob = new VirusScanJob
                {
                    JobId      = "123",
                    RequestId  = "456",
                    RegionCode = "USW",
                };

                _scanningService
                .Setup(x => x.CreateVirusScanJobAsync(It.IsAny <string>(), It.IsAny <Uri>(), It.IsAny <string>(), It.IsAny <Guid>()))
                .Returns(() => Task.FromResult(_virusScanJob));

                _target = new VcsValidator(
                    _callbackUrl,
                    _packageUrlTemplate,
                    _scanningService.Object,
                    _logger.Object);
            }
Beispiel #2
0
 private static bool AreAllJobIdsEmpty(VirusScanJob result)
 {
     return(string.IsNullOrEmpty(result.RequestId) &&
            string.IsNullOrEmpty(result.JobId) &&
            string.IsNullOrEmpty(result.RegionCode));
 }
Beispiel #3
0
 private static bool IsValidJobResult(VirusScanJob result)
 {
     return(string.IsNullOrEmpty(result.ErrorMessage) &&
            !AreAllJobIdsEmpty(result));
 }