18
18
using System . Net ;
19
19
using System . Net . Http ;
20
20
using System . Net . Http . Headers ;
21
- using Hyak . Common ;
22
21
using Microsoft . Azure . Commands . Common . Authentication ;
23
22
using Microsoft . Azure . Commands . Common . Authentication . Abstractions ;
24
23
using Microsoft . Azure . Commands . Common . Authentication . Models ;
25
- using Microsoft . Azure . Graph . RBAC . Version1_6 ;
26
- using Microsoft . Rest ;
27
24
using Microsoft . Rest . ClientRuntime . Azure . TestFramework ;
28
25
#if NETSTANDARD
29
26
using Microsoft . Azure . Commands . Common . Authentication . Abstractions . Core ;
@@ -42,14 +39,9 @@ public TestClientFactory(MockContext mockContext)
42
39
43
40
public TClient CreateArmClient < TClient > ( IAzureContext context , string endpoint ) where TClient : Rest . ServiceClient < TClient >
44
41
{
45
- if ( typeof ( TClient ) != typeof ( GraphRbacManagementClient ) )
46
- {
47
- return _mockContext . GetServiceClient < TClient > ( ) ;
48
- }
49
-
50
- var graphClient = _mockContext . GetGraphServiceClient < GraphRbacManagementClient > ( ) ;
51
- graphClient . TenantID = context . Tenant . Id ;
52
- return graphClient as TClient ;
42
+ return string . Equals ( endpoint , AzureEnvironment . Endpoint . Graph , StringComparison . OrdinalIgnoreCase ) ?
43
+ _mockContext . GetGraphServiceClient < TClient > ( ) :
44
+ _mockContext . GetServiceClient < TClient > ( ) ;
53
45
}
54
46
55
47
public TClient CreateCustomArmClient < TClient > ( params object [ ] parameters ) where TClient : Rest . ServiceClient < TClient >
@@ -99,7 +91,7 @@ public DelegatingHandler[] GetCustomHandlers()
99
91
#region UserAgent
100
92
101
93
public HashSet < ProductInfoHeaderValue > UniqueUserAgents { get ; set ; } = new HashSet < ProductInfoHeaderValue > ( ) ;
102
-
94
+
103
95
public void AddUserAgent ( string productName , string productVersion )
104
96
{
105
97
UniqueUserAgents . Add ( new ProductInfoHeaderValue ( productName , productVersion ) ) ;
0 commit comments