public virtual async Task InitializeAsync() { if (this.Configuration.CreateDevices) { try { await this.CreateOrUpdateDevicesAsync(); } catch (Exception ex) { TestLogger.Log($"[ERR] Failed to create devices in IoT Hub. {ex.ToString()}"); } } if (!string.IsNullOrEmpty(this.Configuration.IoTHubEventHubConnectionString) && this.Configuration.NetworkServerModuleLogAssertLevel != LogValidationAssertLevel.Ignore) { this.IoTHubMessages = new EventHubDataCollector(this.Configuration.IoTHubEventHubConnectionString, this.Configuration.IoTHubEventHubConsumerGroup); await this.IoTHubMessages.StartAsync(); } if (this.Configuration.UdpLog) { this.udpLogListener = new UdpLogListener(this.Configuration.UdpLogPort); this.udpLogListener.Start(); } }
private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { TestLogger.Log($"{nameof(IntegrationTestFixtureBase)} disposed"); if (!this.disposedValue) { if (disposing) { AppDomain.CurrentDomain.UnhandledException -= this.OnUnhandledException; this.IoTHubMessages?.Dispose(); this.IoTHubMessages = null; this.registryManager?.Dispose(); this.registryManager = null; this.udpLogListener?.Dispose(); this.udpLogListener = null; } this.disposedValue = true; } }