public void Dispose_IsStarted_Exception() { var p = new Polling(1000, ct => Task.FromResult(false), Mock.Of <ILogger>()); p.StartPolling(); p.Dispose(); Assert.Throws <ObjectDisposedException>(() => { var _ = p.IsStarted; }); }
/// <inheritdoc /> public void Stop() { try { if (_serviceHealthDependent) { _healthCheckingService.DiagnosticFailedEvent -= OnDiagnosticFailed; _healthCheckingService.DiagnosticPassedEvent -= OnDiagnosticPassed; } _reconnectPolling.Dispose(); _reconnectPolling = null; } finally { Unsubscribe(); } }
/// <inheritdoc/> public void Stop() { try { if (_serviceHealthDependent) { _healthCheckingService.DiagnosticFailedEvent -= OnDiagnosticFailed; _healthCheckingService.DiagnosticPassedEvent -= OnDiagnosticPassed; } _subscribePolling?.Dispose(); _subscribePolling = null; } finally { _adapter.Disconnect(); } }