1
- using Microsoft . ApplicationInsights ;
2
- using Microsoft . Extensions . Logging ;
1
+ using Microsoft . Extensions . Logging ;
3
2
using Microsoft . Extensions . Options ;
4
3
using PnP . Core . Services ;
4
+ using PnP . Core . Test . Utilities ;
5
5
using System ;
6
6
using System . Collections . Generic ;
7
7
using System . Threading . Tasks ;
@@ -48,9 +48,13 @@ public TestPnPContextFactory(
48
48
SharePointRestClient sharePointRestClient ,
49
49
MicrosoftGraphClient microsoftGraphClient ,
50
50
IOptions < PnPContextFactoryOptions > contextOptions ,
51
- IOptions < PnPGlobalSettingsOptions > globalOptions ,
52
- TelemetryClient telemetryClient ) : base ( logger , sharePointRestClient , microsoftGraphClient , contextOptions , globalOptions , telemetryClient )
51
+ IOptions < PnPGlobalSettingsOptions > globalOptions ) : base ( logger , sharePointRestClient , microsoftGraphClient , contextOptions , globalOptions )
53
52
{
53
+ if ( TelemetryManager != null && ! TestCommon . RunningInGitHubWorkflow ( ) )
54
+ {
55
+ // Send telemetry to the test Azure AppInsights instance
56
+ TelemetryManager . TelemetryClient . InstrumentationKey = "6073339d-9e70-4004-9ff7-1345316ade97" ;
57
+ }
54
58
}
55
59
56
60
public override PnPContext Create ( string name )
@@ -96,7 +100,7 @@ public override PnPContext Create(Guid groupId, IAuthenticationProvider authenti
96
100
97
101
public async override Task < PnPContext > CreateAsync ( Guid groupId , IAuthenticationProvider authenticationProvider )
98
102
{
99
- var context = new PnPContext ( Log , authenticationProvider , SharePointRestClient , MicrosoftGraphClient , ContextOptions , GlobalOptions , TelemetryClient ) ;
103
+ var context = new PnPContext ( Log , authenticationProvider , SharePointRestClient , MicrosoftGraphClient , ContextOptions , GlobalOptions , TelemetryManager ) ;
100
104
101
105
ConfigurePnPContextForTesting ( ref context ) ;
102
106
@@ -112,7 +116,7 @@ public override PnPContext Create(Guid groupId)
112
116
113
117
public async override Task < PnPContext > CreateAsync ( Guid groupId )
114
118
{
115
- var context = new PnPContext ( Log , ContextOptions . DefaultAuthenticationProvider , SharePointRestClient , MicrosoftGraphClient , ContextOptions , GlobalOptions , TelemetryClient ) ;
119
+ var context = new PnPContext ( Log , ContextOptions . DefaultAuthenticationProvider , SharePointRestClient , MicrosoftGraphClient , ContextOptions , GlobalOptions , TelemetryManager ) ;
116
120
117
121
ConfigurePnPContextForTesting ( ref context ) ;
118
122
0 commit comments