make IsInitialized internal to be testable from other test projects (#1950)
This commit is contained in:
Родитель
502ff5681e
Коммит
1dd6f599c2
|
@ -13,16 +13,14 @@
|
|||
public sealed class DiagnosticsTelemetryModule : ITelemetryModule, IHeartbeatPropertyManager, IDisposable
|
||||
{
|
||||
internal readonly IList<IDiagnosticsSender> Senders = new List<IDiagnosticsSender>();
|
||||
|
||||
internal readonly DiagnosticsListener EventListener;
|
||||
|
||||
internal readonly IHeartbeatProvider HeartbeatProvider = null;
|
||||
|
||||
private readonly object lockObject = new object();
|
||||
private readonly IDiagnoisticsEventThrottlingScheduler throttlingScheduler = new DiagnoisticsEventThrottlingScheduler();
|
||||
private volatile bool disposed = false;
|
||||
private string instrumentationKey;
|
||||
private bool isInitialized = false;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DiagnosticsTelemetryModule"/> class.
|
||||
/// </summary>
|
||||
|
@ -158,6 +156,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a value indicating whether this module has been initialized.</summary>
|
||||
internal bool IsInitialized { get; private set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes this telemetry module.
|
||||
/// </summary>
|
||||
|
@ -171,11 +172,11 @@
|
|||
|
||||
// Temporary fix to make sure that we initialize module once.
|
||||
// It should be removed when configuration reading logic is moved to Web SDK.
|
||||
if (!this.isInitialized)
|
||||
if (!this.IsInitialized)
|
||||
{
|
||||
lock (this.lockObject)
|
||||
{
|
||||
if (!this.isInitialized)
|
||||
if (!this.IsInitialized)
|
||||
{
|
||||
var queueSender = this.Senders.OfType<PortalDiagnosticsQueueSender>().First();
|
||||
queueSender.IsDisabled = true;
|
||||
|
@ -201,7 +202,7 @@
|
|||
// set up heartbeat
|
||||
this.HeartbeatProvider.Initialize(configuration);
|
||||
|
||||
this.isInitialized = true;
|
||||
this.IsInitialized = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,9 @@ using System.Runtime.InteropServices;
|
|||
[assembly: ComVisible(false)]
|
||||
|
||||
[assembly: InternalsVisibleTo("Microsoft.ApplicationInsights.Tests, PublicKey=" + AssemblyInfo.PublicKey)]
|
||||
|
||||
[assembly: InternalsVisibleTo("Microsoft.ApplicationInsights.TelemetryChannel.Tests, PublicKey=" + AssemblyInfo.PublicKey)]
|
||||
[assembly: InternalsVisibleTo("Microsoft.ApplicationInsights.AspNetCore.Tests, PublicKey=" + AssemblyInfo.PublicKey)]
|
||||
[assembly: InternalsVisibleTo("Microsoft.ApplicationInsights.WorkerService.Tests, PublicKey=" + AssemblyInfo.PublicKey)]
|
||||
|
||||
// Assembly dynamically generated by Moq in unit tests
|
||||
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=" + AssemblyInfo.MoqPublicKey)]
|
||||
|
|
Загрузка…
Ссылка в новой задаче