public SmsHealthCheck(
     IOptions <SmsHealthCheckSettings> options,
     IHealthCheckStorage healthCheckStorage,
     ISmsSender smsSender) : base(healthCheckStorage, smsSender)
 {
     _options = options ?? throw new ArgumentNullException(nameof(options));
 }
示例#2
0
 public EmailHealthCheck(
     IOptions <EmailHealthCheckSettings> options,
     IHealthCheckStorage healthCheckStorage,
     IEmailSender emailSender) : base(healthCheckStorage, emailSender)
 {
     _options = options ?? throw new ArgumentNullException(nameof(options));
 }
示例#3
0
 public TestPeriodicHealthCheck(
     IHealthCheckStorage healthCheckStorage,
     IHealthCheckService healthCheckService,
     TimeSpan checkPeriod) : base(healthCheckStorage, healthCheckService)
 {
     CheckPeriod = checkPeriod;
 }
 public SmtpEmailSender(
     IOptions <SmtpConfig> smtpConfig,
     IHealthCheckStorage healthCheckStorage,
     ILogger <SmtpEmailSender> logger) : base(healthCheckStorage)
 {
     _smtpConfig = smtpConfig.Value ?? throw new ArgumentNullException(nameof(smtpConfig));
     _logger     = logger ?? throw new ArgumentNullException(nameof(logger));
 }
 public FileEmailWriter(IOptions <FileEmailConfig> options, IHealthCheckStorage healthCheckStorage) : base(healthCheckStorage)
 {
     _options = options;
     if (!Directory.Exists(options.Value.FilePath))
     {
         Directory.CreateDirectory(options.Value.FilePath);
     }
 }
示例#6
0
        public SendGridEmailSenderComponent(
            IOrganizationSettingsAccessorService organizationSettingsAccessorService,
            IHealthCheckStorage healthCheckStorage)
        {
            _organizationSettingsAccessorService = organizationSettingsAccessorService ?? throw
                                                       new ArgumentNullException(nameof(organizationSettingsAccessorService));

            _healthCheckStorage = healthCheckStorage ?? throw
                                      new ArgumentNullException(nameof(healthCheckStorage));
        }
示例#7
0
        public TwilioSmsSender(
            IOptions <TwilioOptions> options,
            IHealthCheckStorage healthCheckStorage,
            ILogger <TwilioSmsSender> logger)
        {
            _options            = options ?? throw new ArgumentNullException(nameof(options));
            _healthCheckStorage = healthCheckStorage ?? throw new ArgumentNullException(nameof(healthCheckStorage));
            _logger             = logger ?? throw new ArgumentNullException(nameof(logger));

            TwilioClient.Init(_options.Value.Sid, _options.Value.AuthToken);
        }
示例#8
0
        public async Task Should_Store_Checks_For_Separate_Services(IHealthCheckStorage storage)
        {
            var unhealthy = new HealthCheckStatus(HealthStatus.Unhealthy);
            var healthy   = new HealthCheckStatus(HealthStatus.Healthy);

            await storage.CheckedAsync("s1", unhealthy);

            await storage.CheckedAsync("s2", healthy);

            Assert.Equal(unhealthy, await storage.GetCurrentStatusAsync("s1"));
            Assert.Equal(healthy, await storage.GetCurrentStatusAsync("s2"));
        }
示例#9
0
        public TwilioSmsSenderComponent(
            IOrganizationSettingsAccessorService organizationSettingsAccessorService,
            IHealthCheckStorage healthCheckStorage,
            ILoggerFactory loggerFactory)
        {
            _organizationSettingsAccessorService = organizationSettingsAccessorService ?? throw
                                                       new ArgumentNullException(nameof(organizationSettingsAccessorService));

            _healthCheckStorage = healthCheckStorage ?? throw
                                      new ArgumentNullException(nameof(healthCheckStorage));

            _loggerFactory = loggerFactory ?? throw
                                 new ArgumentNullException(nameof(loggerFactory));
        }
示例#10
0
        public async Task Should_Replace_Older_Value(IHealthCheckStorage storage)
        {
            var olderCheck = new HealthCheckStatus(HealthStatus.Unhealthy)
            {
                DateTime = DateTime.UtcNow.AddSeconds(-1)
            };
            var newerCheck = new HealthCheckStatus(HealthStatus.Healthy);

            await storage.CheckedAsync("test", olderCheck);

            Assert.Equal(olderCheck, await storage.GetCurrentStatusAsync("test"));

            await storage.CheckedAsync("test", newerCheck);

            Assert.Equal(newerCheck, await storage.GetCurrentStatusAsync("test"));
        }
        public HealthCheckMiddleware(
            RequestDelegate next,
            IOptions <HealthCheckOptions> healthCheckOptions,
            IHealthCheckStorage storage,
            string path)
        {
            if (next == null)
            {
                throw new ArgumentNullException(nameof(next));
            }

            if (healthCheckOptions == null)
            {
                throw new ArgumentNullException(nameof(healthCheckOptions));
            }

            _next = next;
            _healthCheckOptions = healthCheckOptions.Value;
            _storage            = storage;
            _path = path;
        }
 public MockEmailSender(ILogger <MockEmailSender> logger, IHealthCheckStorage healthCheckStorage) : base(healthCheckStorage)
 {
     _logger = logger;
 }
示例#13
0
 public async Task Should_Return_Null_When_Getting_Status_Without_Check_Performed(IHealthCheckStorage storage)
 {
     Assert.Null(await storage.GetCurrentStatusAsync("test"));
 }
示例#14
0
 public SendGridEmailSender(IOptions <SendGridConfig> options, IHealthCheckStorage healthCheckStorage) : base(healthCheckStorage)
 {
     _config = options.Value;
 }
 protected AbstractPeriodicHealthCheck(IHealthCheckStorage healthCheckStorage, IHealthCheckService healthCheckService)
 {
     _healthCheckStorage = healthCheckStorage ?? throw new ArgumentNullException(nameof(healthCheckStorage));
     _healthCheckService = healthCheckService ?? throw new ArgumentNullException(nameof(healthCheckService));
 }
示例#16
0
 public HealthCheckMonitor(HealthCheckService healthCheckService,
                           IHealthCheckStorage storage)
 {
     _healthCheckService = healthCheckService;
     _storage            = storage;
 }