public void SimpleTimeWorksWhenDisposedCalledTwice() { var clientFactory = new Mock <IClientFactory>(); var telemetryDataCollector = new Mock <ITelemetryDataCollector>(); clientFactory .Setup(x => x.GetClient <CustomerIntelligenceHttpClient>()) .Returns((CustomerIntelligenceHttpClient)null); telemetryDataCollector.Setup(x => x.PublishTelemetryAsync(It.IsAny <string>(), It.IsAny <Dictionary <string, object> >())); var timer = new SimpleTimer("Test", "test", telemetryDataCollector.Object); timer.Dispose(); timer.Dispose(); }
/// <summary> /// Dispose of resources. /// </summary> public void Dispose() { _isStopped = true; _client?.Dispose(); _commandManager?.Dispose(); _maintenanceTimer?.Dispose(); }
public void SimpleTimeWorksWhenDisposedCalledTwice() { var verboseLogCalled = false; var logger = new Mock <TraceLogger>(new TextWriterTraceListener()); var clientFactory = new Mock <ClientFactory>(null); var telemetryDataCollector = new Mock <TelemetryDataCollector>(clientFactory.Object, logger.Object); clientFactory .Setup(x => x.GetClient <CustomerIntelligenceHttpClient>()) .Returns((CustomerIntelligenceHttpClient)null); logger.Setup(x => x.Verbose(It.IsAny <string>())).Callback((() => verboseLogCalled = true)); telemetryDataCollector.Setup(x => x.PublishTelemetryAsync(It.IsAny <string>(), It.IsAny <Dictionary <string, object> >())) .Callback((() => verboseLogCalled = true)); var timer = new SimpleTimer("testTimer", "Test", "test", logger.Object, telemetryDataCollector.Object, TimeSpan.FromMilliseconds(0), true); timer.Dispose(); timer.Dispose(); }