Skip to content

Commit dcf1326

Browse files
committed
Update Resources project with new references, re-record tests
1 parent 4a128bc commit dcf1326

File tree

59 files changed

+1842
-7965
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1842
-7965
lines changed

src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Commands.Resources.Rest.csproj

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -46,40 +46,12 @@
4646
<Prefer32Bit>false</Prefer32Bit>
4747
</PropertyGroup>
4848
<ItemGroup>
49-
<Reference Include="Hyak.Common">
50-
<SpecificVersion>False</SpecificVersion>
51-
<HintPath>..\..\..\..\packages\Hyak.Common.1.0.3\lib\net45\Hyak.Common.dll</HintPath>
52-
</Reference>
53-
<Reference Include="Microsoft.Azure.Common">
54-
<SpecificVersion>False</SpecificVersion>
55-
<HintPath>..\..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll</HintPath>
56-
</Reference>
5749
<Reference Include="Microsoft.Azure.Management.ResourceManager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
5850
<SpecificVersion>False</SpecificVersion>
5951
<HintPath>..\..\..\..\packages\Microsoft.Azure.Management.ResourceManager.1.6.0-preview\lib\net452\Microsoft.Azure.Management.ResourceManager.dll</HintPath>
6052
</Reference>
61-
<Reference Include="Microsoft.CSharp" />
62-
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
63-
<HintPath>..\..\..\..\packages\Microsoft.Rest.ClientRuntime.2.3.8\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
64-
<Private>True</Private>
65-
</Reference>
66-
<Reference Include="Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
67-
<HintPath>..\..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.7\lib\net452\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
68-
<Private>True</Private>
69-
</Reference>
70-
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
71-
<SpecificVersion>False</SpecificVersion>
72-
<HintPath>..\..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
73-
</Reference>
74-
<Reference Include="System" />
75-
<Reference Include="System.Core" />
7653
<Reference Include="System.Management.Automation" />
77-
<Reference Include="System.Net" />
78-
<Reference Include="System.Net.Http" />
79-
<Reference Include="System.Net.Http.WebRequest" />
8054
<Reference Include="System.Runtime.Caching" />
81-
<Reference Include="System.Runtime.Serialization" />
82-
<Reference Include="System.Xml" />
8355
</ItemGroup>
8456
<ItemGroup>
8557
<Compile Include="Collections\InsensitiveDictionary.cs" />
@@ -255,10 +227,6 @@
255227
<Project>{3819d8a7-c62c-4c47-8ddd-0332d9ce1252}</Project>
256228
<Name>Commands.ResourceManager.Common</Name>
257229
</ProjectReference>
258-
<ProjectReference Include="..\..\..\Tags\Commands.Tags\Commands.Tags.csproj">
259-
<Project>{2493A8F7-1949-4F29-8D53-9D459046C3B8}</Project>
260-
<Name>Commands.Tags</Name>
261-
</ProjectReference>
262230
</ItemGroup>
263231
<ItemGroup>
264232
<EmbeddedResource Include="Properties\Resources.resx">
@@ -269,4 +237,5 @@
269237
</ItemGroup>
270238
<ItemGroup />
271239
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
240+
<Import Project="..\..\..\..\..\tools\Common.Dependencies.targets" />
272241
</Project>

src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/SdkExtensions/ResourcesExtensions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
using System.Text;
2020
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels;
2121
using Microsoft.Azure.Commands.ResourceManager.Common.Tags;
22-
using Microsoft.Azure.Commands.Tags.Model;
2322
using Microsoft.Azure.Management.ResourceManager.Models;
2423
using Microsoft.WindowsAzure.Commands.Utilities.Common;
2524
using Newtonsoft.Json;
Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Hyak.Common" version="1.0.3" targetFramework="net45" />
4-
<package id="Microsoft.Azure.Common" version="2.1.0" targetFramework="net45" />
5-
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
63
<package id="Microsoft.Azure.Management.ResourceManager" version="1.6.0-preview" targetFramework="net452" />
7-
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net45" />
8-
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net45" />
9-
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net45" />
10-
<package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net45" />
11-
<package id="Microsoft.Rest.ClientRuntime" version="2.3.8" targetFramework="net452" />
12-
<package id="Microsoft.Rest.ClientRuntime.Azure" version="3.3.7" targetFramework="net452" />
13-
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
14-
</packages>
4+
</packages>

src/ResourceManager/Resources/Commands.Resources.Test/Commands.Resources.Test.csproj

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
</Reference>
8484
<Reference Include="Microsoft.Azure.Test.HttpRecorder, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
8585
<HintPath>..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.6.7-preview\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll</HintPath>
86+
<Private>True</Private>
8687
</Reference>
8788
<Reference Include="Microsoft.Data.Edm">
8889
<SpecificVersion>False</SpecificVersion>
@@ -97,12 +98,12 @@
9798
<HintPath>..\..\..\packages\Microsoft.Data.Services.Client.5.6.4\lib\net40\Microsoft.Data.Services.Client.dll</HintPath>
9899
</Reference>
99100
<Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.28.3.860, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
100-
<SpecificVersion>False</SpecificVersion>
101101
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.28.3\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll</HintPath>
102+
<Private>True</Private>
102103
</Reference>
103104
<Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms, Version=2.28.3.860, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
104-
<SpecificVersion>False</SpecificVersion>
105105
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.28.3\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll</HintPath>
106+
<Private>True</Private>
106107
</Reference>
107108
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
108109
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.3.5\lib\net45\Microsoft.Rest.ClientRuntime.dll</HintPath>
@@ -164,6 +165,7 @@
164165
<Private>True</Private>
165166
</Reference>
166167
<Reference Include="System.Net.Http.WebRequest" />
168+
<Reference Include="System.Runtime.Serialization" />
167169
<Reference Include="System.Spatial">
168170
<SpecificVersion>False</SpecificVersion>
169171
<HintPath>..\..\..\packages\System.Spatial.5.6.4\lib\net40\System.Spatial.dll</HintPath>
@@ -246,6 +248,14 @@
246248
<Project>{d3804b64-c0d3-48f8-82ec-1f632f833c9e}</Project>
247249
<Name>Commands.Common.Authentication</Name>
248250
</ProjectReference>
251+
<ProjectReference Include="..\..\..\Common\Commands.Common.Authorization\Commands.Common.Authorization.csproj">
252+
<Project>{24508e26-154d-47f1-80ee-439bf0710996}</Project>
253+
<Name>Commands.Common.Authorization</Name>
254+
</ProjectReference>
255+
<ProjectReference Include="..\..\..\Common\Commands.Common.Graph.RBAC\Commands.Common.Graph.RBAC.csproj">
256+
<Project>{269acf73-0a34-42dc-ab9c-4b15931a489d}</Project>
257+
<Name>Commands.Common.Graph.RBAC</Name>
258+
</ProjectReference>
249259
<ProjectReference Include="..\..\..\Common\Commands.Common\Commands.Common.csproj">
250260
<Project>{5ee72c53-1720-4309-b54b-5fb79703195f}</Project>
251261
<Name>Commands.Common</Name>

src/ResourceManager/Resources/Commands.Resources.Test/Models.ResourceGroups/ExtensionsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// ----------------------------------------------------------------------------------
1414

1515
using Microsoft.Azure.Commands.Resources.Models;
16-
using Microsoft.Azure.Gallery;
16+
using Microsoft.Azure.Commands.Resources.Models.Gallery;
1717
using Microsoft.Azure.ServiceManagemenet.Common.Models;
1818
using Microsoft.WindowsAzure.Commands.ScenarioTest;
1919
using System.Collections.Generic;

src/ResourceManager/Resources/Commands.Resources.Test/Models.ResourceGroups/ResourceClientTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels;
2828
using Microsoft.Azure.Commands.Resources.Models;
2929
using Microsoft.Azure.Commands.ScenarioTest;
30-
using Microsoft.Azure.Management.Authorization;
30+
using Microsoft.Azure.Management.Authorization.Version2015_07_01;
3131
using Microsoft.Azure.Management.ResourceManager;
3232
using Microsoft.Azure.Management.ResourceManager.Models;
3333
using Microsoft.Rest.Azure;

src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/ActiveDirectoryTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using Microsoft.Azure.Graph.RBAC;
16-
using Microsoft.Azure.Graph.RBAC.Models;
15+
using Microsoft.Azure.Graph.RBAC.Version1_6;
16+
using Microsoft.Azure.Graph.RBAC.Version1_6.Models;
1717
using Microsoft.Azure.ServiceManagemenet.Common.Models;
1818
using Microsoft.Azure.Test;
1919
using Microsoft.WindowsAzure.Commands.ScenarioTest;

src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/ResourcesController.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@
2121
using Microsoft.Azure.Commands.Common.Authentication;
2222
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components;
2323
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions;
24-
using Microsoft.Azure.Gallery;
25-
using Microsoft.Azure.Graph.RBAC;
24+
using Microsoft.Azure.Graph.RBAC.Version1_6;
2625
using Microsoft.Azure.Insights;
27-
using Microsoft.Azure.Management.Authorization;
26+
using Microsoft.Azure.Management.Authorization.Version2015_07_01;
2827
using Microsoft.Azure.Management.ResourceManager;
2928
using Microsoft.Azure.Test.HttpRecorder;
3029
using Microsoft.Rest.ClientRuntime.Azure.TestFramework;
@@ -38,6 +37,7 @@
3837
using Microsoft.Azure.Test.Authentication;
3938
using Microsoft.Azure.ServiceManagemenet.Common.Models;
4039
using Microsoft.Azure.Commands.Common.Authentication.Abstractions;
40+
using Microsoft.Azure.Commands.Resources.Models.Gallery;
4141

4242
namespace Microsoft.Azure.Commands.Resources.Test.ScenarioTests
4343
{
@@ -179,7 +179,7 @@ private void SetupManagementClients(MockContext context)
179179
ResourceManagementClient = GetResourceManagementClient(context);
180180
SubscriptionClient = GetSubscriptionClient(context);
181181
GalleryClient = GetGalleryClient();
182-
AuthorizationManagementClient = GetAuthorizationManagementClient();
182+
AuthorizationManagementClient = GetAuthorizationManagementClient(context);
183183
GraphClient = GetGraphClient(context);
184184
InsightsClient = GetInsightsClient();
185185
this.FeatureClient = this.GetFeatureClient(context);
@@ -241,9 +241,9 @@ private GraphRbacManagementClient GetGraphClient(MockContext context)
241241
return client;
242242
}
243243

244-
private AuthorizationManagementClient GetAuthorizationManagementClient()
244+
private AuthorizationManagementClient GetAuthorizationManagementClient(MockContext context)
245245
{
246-
return LegacyTest.TestBase.GetServiceClient<AuthorizationManagementClient>(this.csmTestFactory);
246+
return context.GetServiceClient<AuthorizationManagementClient>(TestEnvironmentFactory.GetTestEnvironment());
247247
}
248248

249249
private FeatureClient GetFeatureClient(MockContext context)

src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/RoleAssignmentTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
// ----------------------------------------------------------------------------------
1414

1515

16-
using Microsoft.Azure.Graph.RBAC;
17-
using Microsoft.Azure.Graph.RBAC.Models;
18-
using Microsoft.Azure.Management.Authorization;
16+
using Microsoft.Azure.Graph.RBAC.Version1_6;
17+
using Microsoft.Azure.Graph.RBAC.Version1_6.Models;
18+
using Microsoft.Azure.Management.Authorization.Version2015_07_01;
1919
using Microsoft.Azure.Management.ResourceManager;
2020
using Microsoft.Azure.Management.ResourceManager.Models;
2121
using Microsoft.Azure.ServiceManagemenet.Common.Models;
@@ -219,7 +219,7 @@ public void RaUserPermissions()
219219

220220
if (resourceGroup != null)
221221
{
222-
controllerAdmin.AuthorizationManagementClient.RoleAssignments.Delete(resourceGroup.Id, new Guid(roleAssignmentId));
222+
controllerAdmin.AuthorizationManagementClient.RoleAssignments.Delete(resourceGroup.Id, new Guid(roleAssignmentId).ToString());
223223
}
224224
},
225225
TestUtilities.GetCallingClass(),

src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/RoleAssignmentTests.ps1

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function Test-RaByScope
7676
Assert-AreEqual 1 $users.Count "There should be at least one user to run the test."
7777

7878
# Test
79-
[Microsoft.Azure.Commands.Resources.Models.Authorization.AuthorizationClient]::RoleAssignmentNames.Enqueue("fa1a4d3b-2cca-406b-8956-6b6b32377641")
79+
[Microsoft.Azure.Commands.Resources.Models.Authorization.AuthorizationClient]::RoleAssignmentNames.Enqueue("f747531e-da33-43b9-b726-04675abf1939")
8080
$newAssignment = New-AzureRmRoleAssignment `
8181
-ObjectId $users[0].Id.Guid `
8282
-RoleDefinitionName $definitionName `
@@ -110,7 +110,7 @@ function Test-RaByResourceGroup
110110
Assert-AreEqual 1 $resourceGroups.Count "No resource group found. Unable to run the test."
111111

112112
# Test
113-
[Microsoft.Azure.Commands.Resources.Models.Authorization.AuthorizationClient]::RoleAssignmentNames.Enqueue("7a750d57-9d92-4be1-ad66-f099cecffc01")
113+
[Microsoft.Azure.Commands.Resources.Models.Authorization.AuthorizationClient]::RoleAssignmentNames.Enqueue("8748e3e7-2cc7-41a9-81ed-b704b6d328a5")
114114
$newAssignment = New-AzureRmRoleAssignment `
115115
-ObjectId $users[0].Id.Guid `
116116
-RoleDefinitionName $definitionName `
@@ -145,7 +145,7 @@ function Test-RaByResource
145145
Assert-NotNull $resource "Cannot find any resource to continue test execution."
146146

147147
# Test
148-
[Microsoft.Azure.Commands.Resources.Models.Authorization.AuthorizationClient]::RoleAssignmentNames.Enqueue("78D6502F-74FC-4800-BB0A-0E1A7BEBECA4")
148+
[Microsoft.Azure.Commands.Resources.Models.Authorization.AuthorizationClient]::RoleAssignmentNames.Enqueue("db6e0231-1be9-4bcd-bf16-79de537439fe")
149149
$newAssignment = New-AzureRmRoleAssignment `
150150
-ObjectId $groups[0].Id.Guid `
151151
-RoleDefinitionName $definitionName `
@@ -204,11 +204,11 @@ function Test-RaValidateInputParameters ($cmdName)
204204
Assert-Throws { &$cmdName -Scope $scope -ObjectId $groups[0].Id.Guid -RoleDefinitionName $definitionName } $invalidScope
205205

206206
# Check if ResourceType is valid
207-
Assert-AreEqual $resource.ResourceType "Microsoft.Sql/servers"
207+
Assert-AreEqual $resource.ResourceType "Microsoft.KeyVault/vaults"
208208

209209
# Below invalid resource type should not return 'Not supported api version'.
210-
$resource.ResourceType = "Microsoft.Sql/"
211-
$invalidResourceType = "Scope '/subscriptions/4004a9fd-d58e-48dc-aeb2-4a4aec58606f/resourceGroups/testrg19972/providers/Microsoft.Sql/testserver1342' should have even number of parts."
210+
$resource.ResourceType = "Microsoft.KeyVault/"
211+
$invalidResourceType = "Scope '/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/zzzzlastgroupzz/providers/Microsoft.KeyVault/zzzzlastgroupzz' should have even number of parts."
212212
Assert-Throws { &$cmdName `
213213
-ObjectId $groups[0].Id.Guid `
214214
-RoleDefinitionName $definitionName `
@@ -234,7 +234,7 @@ function Test-RaByServicePrincipal
234234
Assert-AreEqual 1 $servicePrincipals.Count "No service principals found. Unable to run the test."
235235

236236
# Test
237-
[Microsoft.Azure.Commands.Resources.Models.Authorization.AuthorizationClient]::RoleAssignmentNames.Enqueue("a4b82891-ebee-4568-b606-632899bf9453")
237+
[Microsoft.Azure.Commands.Resources.Models.Authorization.AuthorizationClient]::RoleAssignmentNames.Enqueue("0b018870-59ba-49ca-9405-9ba5dce77311")
238238
$newAssignment = New-AzureRmRoleAssignment `
239239
-ServicePrincipalName $servicePrincipals[0].ServicePrincipalNames[0] `
240240
-RoleDefinitionName $definitionName `
@@ -269,7 +269,7 @@ function Test-RaByUpn
269269
Assert-AreEqual 1 $resourceGroups.Count "No resource group found. Unable to run the test."
270270

271271
# Test
272-
[Microsoft.Azure.Commands.Resources.Models.Authorization.AuthorizationClient]::RoleAssignmentNames.Enqueue("8E052D34-3F84-4083-BA00-5E8772F7D46D")
272+
[Microsoft.Azure.Commands.Resources.Models.Authorization.AuthorizationClient]::RoleAssignmentNames.Enqueue("f8dac632-b879-42f9-b4ab-df2aab22a149")
273273
$newAssignment = New-AzureRmRoleAssignment `
274274
-SignInName $users[0].UserPrincipalName `
275275
-RoleDefinitionName $definitionName `

src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/RoleDefinitionTests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function Test-RdNegativeScenarios
7171

7272
$rdId = '85E460B3-89E9-48BA-9DCD-A8A99D64A674'
7373

74-
$badIdException = "RoleDefinitionDoesNotExist: The specified role definition with ID '" + $rdId + "' does not exist."
74+
$badIdException = "The specified role definition with ID '" + $rdId + "' does not exist."
7575

7676
# Throws on trying to update the a role that does not exist
7777
Assert-Throws { Set-AzureRmRoleDefinition -InputFile .\Resources\RoleDefinition.json } $badIdException

src/ResourceManager/Resources/Commands.Resources.Test/SessionRecords/Microsoft.Azure.Commands.Resources.Test.ScenarioTests.RoleAssignmentTests/RaByResource.json

Lines changed: 299 additions & 1120 deletions
Large diffs are not rendered by default.

src/ResourceManager/Resources/Commands.Resources.Test/SessionRecords/Microsoft.Azure.Commands.Resources.Test.ScenarioTests.RoleAssignmentTests/RaByResourceGroup.json

Lines changed: 273 additions & 1422 deletions
Large diffs are not rendered by default.

src/ResourceManager/Resources/Commands.Resources.Test/SessionRecords/Microsoft.Azure.Commands.Resources.Test.ScenarioTests.RoleAssignmentTests/RaByScope.json

Lines changed: 218 additions & 1629 deletions
Large diffs are not rendered by default.

src/ResourceManager/Resources/Commands.Resources.Test/SessionRecords/Microsoft.Azure.Commands.Resources.Test.ScenarioTests.RoleAssignmentTests/RaByServicePrincipal.json

Lines changed: 315 additions & 250 deletions
Large diffs are not rendered by default.

src/ResourceManager/Resources/Commands.Resources.Test/SessionRecords/Microsoft.Azure.Commands.Resources.Test.ScenarioTests.RoleAssignmentTests/RaByUpn.json

Lines changed: 292 additions & 1444 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)