public FactsBase()
            {
                _state = new Mock <IRevalidationStateService>();

                _config = new RevalidationConfiguration
                {
                    MinPackageEventRate = 100,
                    MaxPackageEventRate = 500,
                };

                _target = new RevalidationJobStateService(
                    _state.Object,
                    _config,
                    Mock.Of <ILogger <RevalidationJobStateService> >());
            }
示例#2
0
            public TheIsThrottledAsyncMethod()
            {
                _settings = new Mock <IRevalidationJobStateService>();
                _state    = new Mock <IPackageRevalidationStateService>();
                _gallery  = new Mock <IGalleryService>();

                _config = new RevalidationConfiguration();

                _target = new RevalidationThrottler(
                    _settings.Object,
                    _state.Object,
                    _gallery.Object,
                    _config,
                    Mock.Of <ILogger <RevalidationThrottler> >());
            }
示例#3
0
            public FactsBase()
            {
                _jobState         = new Mock <IRevalidationJobStateService>();
                _throttler        = new Mock <IRevalidationThrottler>();
                _scopeFactory     = new Mock <IServiceScopeFactory>();
                _telemetryService = new Mock <ITelemetryService>();

                _starter = new Mock <IRevalidationStarter>();

                var scope    = new Mock <IServiceScope>();
                var provider = new Mock <IServiceProvider>();

                _scopeFactory.Setup(f => f.CreateScope()).Returns(scope.Object);
                scope.Setup(s => s.ServiceProvider).Returns(provider.Object);
                provider.Setup(p => p.GetService(typeof(IRevalidationStarter))).Returns(_starter.Object);

                _operation = new DurationMetric <StartNextRevalidationOperation>(
                    Mock.Of <ITelemetryClient>(),
                    "Name",
                    new StartNextRevalidationOperation(),
                    Mock.Of <Func <StartNextRevalidationOperation, IDictionary <string, string> > >());

                _telemetryService
                .Setup(t => t.TrackStartNextRevalidationOperation())
                .Returns(_operation);

                _config = new RevalidationConfiguration
                {
                    ShutdownWaitInterval = TimeSpan.MinValue,
                };

                _revalidation = new PackageRevalidation
                {
                    PackageId = "Foo.Bar",
                    PackageNormalizedVersion = "1.2.3",
                    ValidationTrackingId     = Guid.NewGuid()
                };

                _target = new RevalidationService(
                    _jobState.Object,
                    _throttler.Object,
                    _scopeFactory.Object,
                    _config,
                    _telemetryService.Object,
                    Mock.Of <ILogger <RevalidationService> >());
            }
            public Base()
            {
                _config = new RevalidationConfiguration
                {
                    SignaturePromotionScanSize        = 50,
                    SignaturePromotionBatchSize       = 2,
                    CertificateRevalidationBatchSize  = 2,
                    RevalidationPeriodForCertificates = TimeSpan.FromDays(1),
                    CertificateRevalidationPollTime   = TimeSpan.FromSeconds(0.05),
                    CertificateRevalidationTrackAfter = TimeSpan.FromSeconds(0.2),
                    CertificateRevalidationTimeout    = TimeSpan.FromSeconds(0.3),
                };

                _context   = new Mock <IValidationEntitiesContext>();
                _enqueuer  = new Mock <IValidateCertificateEnqueuer>();
                _telemetry = new Mock <ITelemetryService>();

                _target = new CertificateRevalidator(
                    _config,
                    _context.Object,
                    _enqueuer.Object,
                    _telemetry.Object,
                    Mock.Of <ILogger <CertificateRevalidator> >());
            }