@@ -106,7 +106,7 @@ public T GetServiceClient<T>(TestEnvironment currentEnvironment, bool internalBa
106
106
$ "Unable to create Service Client because { nameof ( T ) } authentication token was not acquired during Login.") ;
107
107
}
108
108
109
- return GetServiceClientWithCredentials < T > ( currentEnvironment , currentEnvironment . TokenInfo [ TokenAudience . Management ] , internalBaseUri , handlers ) ;
109
+ return GetServiceClientWithCredentials < T > ( currentEnvironment , currentEnvironment . BaseUri , currentEnvironment . TokenInfo [ TokenAudience . Management ] , internalBaseUri , handlers ) ;
110
110
}
111
111
112
112
/// <summary>
@@ -135,7 +135,7 @@ public T GetGraphServiceClient<T>(TestEnvironment currentEnvironment, bool inter
135
135
"Unable to create Graph Client because Graph authentication token was not acquired during Login." ) ;
136
136
}
137
137
138
- return GetServiceClientWithCredentials < T > ( currentEnvironment , currentEnvironment . TokenInfo [ TokenAudience . Graph ] , internalBaseUri , handlers ) ;
138
+ return GetServiceClientWithCredentials < T > ( currentEnvironment , currentEnvironment . Endpoints . GraphUri , currentEnvironment . TokenInfo [ TokenAudience . Graph ] , internalBaseUri , handlers ) ;
139
139
}
140
140
141
141
/// <summary>
@@ -146,14 +146,15 @@ public T GetGraphServiceClient<T>(TestEnvironment currentEnvironment, bool inter
146
146
/// <param name="baseUri">Base Uri</param>
147
147
/// <param name="handlers">Delegating existingHandlers</param>
148
148
/// <returns></returns>
149
- public T GetServiceClientWithCredentials < T > ( TestEnvironment currentEnvironment , object credentials , bool internalBaseUri = false , params DelegatingHandler [ ] handlers ) where T : class
149
+ public T GetServiceClientWithCredentials < T > ( TestEnvironment currentEnvironment , Uri baseUri , object credentials , bool internalBaseUri , params DelegatingHandler [ ] handlers ) where T : class
150
150
{
151
151
T client ;
152
152
handlers = AddHandlers ( currentEnvironment , handlers ) ;
153
153
var constructors = typeof ( T ) . GetConstructors ( BindingFlags . Public | BindingFlags . Static | BindingFlags . Instance | BindingFlags . NonPublic ) ;
154
154
155
+ Uri uri = baseUri ?? currentEnvironment . BaseUri ;
155
156
ConstructorInfo constructor = null ;
156
- if ( ! internalBaseUri && currentEnvironment . BaseUri != null )
157
+ if ( ! internalBaseUri && uri != null )
157
158
{
158
159
foreach ( var c in constructors )
159
160
{
@@ -173,7 +174,7 @@ public T GetServiceClientWithCredentials<T>(TestEnvironment currentEnvironment,
173
174
}
174
175
client = constructor . Invoke ( new object [ ]
175
176
{
176
- currentEnvironment . BaseUri ,
177
+ uri ,
177
178
credentials ,
178
179
handlers
179
180
} ) as T ;
0 commit comments