Improves configuration and telemetry handling in tests
Adds null checks for telemetry and logging configurations Prevents registration of modules with empty configuration Updates test configuration file copy behavior Enhances robustness of test infrastructure by conditionally registering telemetry and logging modules only when valid configuration is present
This commit is contained in:
parent
5275a75502
commit
3aeae6315b
3 changed files with 96 additions and 91 deletions
|
|
@ -1,4 +1,4 @@
|
|||
using System.Data;
|
||||
using System.Data;
|
||||
using Microsoft.ApplicationInsights;
|
||||
using Microsoft.ApplicationInsights.DataContracts;
|
||||
using SWP.Core.Database.ConnectionFactory;
|
||||
|
|
@ -10,10 +10,10 @@ public class SqlOperations : IDatabaseOperations
|
|||
private readonly IDbConnectionFactory _connectionFactory;
|
||||
private readonly TelemetryClient _telemetryClient;
|
||||
|
||||
public SqlOperations(IDbConnectionFactory connectionFactory, TelemetryClient telemetryClient)
|
||||
public SqlOperations(IDbConnectionFactory connectionFactory, TelemetryClient telemetryClient = null)
|
||||
{
|
||||
_connectionFactory = connectionFactory;
|
||||
_telemetryClient = telemetryClient;
|
||||
_connectionFactory = connectionFactory;
|
||||
_telemetryClient = telemetryClient ?? new TelemetryClient();
|
||||
}
|
||||
|
||||
public DatabaseScope CreateScope(string operationName)
|
||||
|
|
@ -54,4 +54,4 @@ public class SqlOperations : IDatabaseOperations
|
|||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue