Skip to content

Commit 46a3edf

Browse files
authored
[ApiManagement] Migrate Track1 tests (#34105)
1 parent 232c12b commit 46a3edf

File tree

165 files changed

+209434
-18
lines changed

Some content is hidden

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

165 files changed

+209434
-18
lines changed

eng/Packages.Data.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@
198198
<PackageReference Update="Azure.ResourceManager.PrivateDns" Version="1.0.0" />
199199
<PackageReference Update="Azure.ResourceManager.Resources" Version="1.4.0" />
200200
<PackageReference Update="Azure.ResourceManager.Storage" Version="1.1.0" />
201+
<PackageReference Update="Azure.ResourceManager.EventHubs" Version="1.0.0" />
201202
<PackageReference Update="Azure.Search.Documents" Version="11.2.0" />
202203
<PackageReference Update="Azure.Security.KeyVault.Keys" Version="4.4.0" />
203204
<PackageReference Update="Azure.Security.KeyVault.Secrets" Version="4.2.0-beta.4" />

eng/templates/Azure.ResourceManager.Template/tests/ProviderShortNameManagementTestBase.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ namespace Azure.ResourceManager.Template.Tests
1313
public class ProviderShortNameManagementTestBase : ManagementRecordedTestBase<ProviderShortNameManagementTestEnvironment>
1414
{
1515
protected ArmClient Client { get; private set; }
16+
protected SubscriptionResource DefaultSubscription { get; private set; }
1617

1718
protected ProviderShortNameManagementTestBase(bool isAsync, RecordedTestMode mode)
1819
: base(isAsync, mode)
@@ -25,9 +26,10 @@ protected ProviderShortNameManagementTestBase(bool isAsync)
2526
}
2627

2728
[SetUp]
28-
public void CreateCommonClient()
29+
public async Task CreateCommonClient()
2930
{
3031
Client = GetArmClient();
32+
DefaultSubscription = await Client.GetDefaultSubscriptionAsync().ConfigureAwait(false);
3133
}
3234

3335
protected async Task<ResourceGroupResource> CreateResourceGroup(SubscriptionResource subscription, string rgNamePrefix, AzureLocation location)

sdk/apimanagement/Azure.ResourceManager.ApiManagement/Azure.ResourceManager.ApiManagement.sln

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.30309.148
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.4.33213.308
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{BA6279E1-15B0-4130-9D88-65305CB95784}") = "Azure.ResourceManager.ApiManagement", "src\Azure.ResourceManager.ApiManagement.csproj", "{A674866A-5F80-49D6-85DD-8403C83E3C55}"
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.ApiManagement", "src\Azure.ResourceManager.ApiManagement.csproj", "{A674866A-5F80-49D6-85DD-8403C83E3C55}"
77
EndProject
8-
Project("{BA6279E1-15B0-4130-9D88-65305CB95784}") = "Azure.ResourceManager.ApiManagement.Tests", "tests\Azure.ResourceManager.ApiManagement.Tests.csproj", "{A5FFA29E-B174-4976-A2F5-A908647318E9}"
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.ApiManagement.Tests", "tests\Azure.ResourceManager.ApiManagement.Tests.csproj", "{A5FFA29E-B174-4976-A2F5-A908647318E9}"
99
EndProject
10-
Project("{BA6279E1-15B0-4130-9D88-65305CB95784}") = "Azure.ResourceManager.ApiManagement.Samples", "samples\Azure.ResourceManager.ApiManagement.Samples.csproj", "{B20CA0CA-F4A7-4B38-AF96-4C4F3D57D51E}"
10+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.ApiManagement.Samples", "samples\Azure.ResourceManager.ApiManagement.Samples.csproj", "{B20CA0CA-F4A7-4B38-AF96-4C4F3D57D51E}"
1111
EndProject
1212
Global
13-
GlobalSection(SolutionProperties) = preSolution
14-
HideSolutionNode = FALSE
15-
EndGlobalSection
16-
GlobalSection(ExtensibilityGlobals) = postSolution
17-
SolutionGuid = {1A5550A2-BBC2-4EE2-BF8A-0C26C921E08E}
18-
EndGlobalSection
1913
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2014
Debug|Any CPU = Debug|Any CPU
2115
Debug|x64 = Debug|x64
@@ -49,5 +43,23 @@ Global
4943
{A5FFA29E-B174-4976-A2F5-A908647318E9}.Release|x64.Build.0 = Release|Any CPU
5044
{A5FFA29E-B174-4976-A2F5-A908647318E9}.Release|x86.ActiveCfg = Release|Any CPU
5145
{A5FFA29E-B174-4976-A2F5-A908647318E9}.Release|x86.Build.0 = Release|Any CPU
46+
{B20CA0CA-F4A7-4B38-AF96-4C4F3D57D51E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
47+
{B20CA0CA-F4A7-4B38-AF96-4C4F3D57D51E}.Debug|Any CPU.Build.0 = Debug|Any CPU
48+
{B20CA0CA-F4A7-4B38-AF96-4C4F3D57D51E}.Debug|x64.ActiveCfg = Debug|Any CPU
49+
{B20CA0CA-F4A7-4B38-AF96-4C4F3D57D51E}.Debug|x64.Build.0 = Debug|Any CPU
50+
{B20CA0CA-F4A7-4B38-AF96-4C4F3D57D51E}.Debug|x86.ActiveCfg = Debug|Any CPU
51+
{B20CA0CA-F4A7-4B38-AF96-4C4F3D57D51E}.Debug|x86.Build.0 = Debug|Any CPU
52+
{B20CA0CA-F4A7-4B38-AF96-4C4F3D57D51E}.Release|Any CPU.ActiveCfg = Release|Any CPU
53+
{B20CA0CA-F4A7-4B38-AF96-4C4F3D57D51E}.Release|Any CPU.Build.0 = Release|Any CPU
54+
{B20CA0CA-F4A7-4B38-AF96-4C4F3D57D51E}.Release|x64.ActiveCfg = Release|Any CPU
55+
{B20CA0CA-F4A7-4B38-AF96-4C4F3D57D51E}.Release|x64.Build.0 = Release|Any CPU
56+
{B20CA0CA-F4A7-4B38-AF96-4C4F3D57D51E}.Release|x86.ActiveCfg = Release|Any CPU
57+
{B20CA0CA-F4A7-4B38-AF96-4C4F3D57D51E}.Release|x86.Build.0 = Release|Any CPU
58+
EndGlobalSection
59+
GlobalSection(SolutionProperties) = preSolution
60+
HideSolutionNode = FALSE
61+
EndGlobalSection
62+
GlobalSection(ExtensibilityGlobals) = postSolution
63+
SolutionGuid = {1A5550A2-BBC2-4EE2-BF8A-0C26C921E08E}
5264
EndGlobalSection
5365
EndGlobal

sdk/apimanagement/Azure.ResourceManager.ApiManagement/tests/ApiManagementManagementTestBase.cs

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ namespace Azure.ResourceManager.ApiManagement.Tests
1212
{
1313
public class ApiManagementManagementTestBase : ManagementRecordedTestBase<ApiManagementManagementTestEnvironment>
1414
{
15+
protected AzureLocation DefaultLocation => AzureLocation.EastUS;
1516
protected ArmClient Client { get; private set; }
17+
protected SubscriptionResource DefaultSubscription { get; private set; }
1618

1719
protected ApiManagementManagementTestBase(bool isAsync, RecordedTestMode mode)
1820
: base(isAsync, mode)
@@ -25,17 +27,26 @@ protected ApiManagementManagementTestBase(bool isAsync)
2527
}
2628

2729
[SetUp]
28-
public void CreateCommonClient()
30+
public async Task CreateCommonClient()
2931
{
3032
Client = GetArmClient();
33+
DefaultSubscription = await Client.GetDefaultSubscriptionAsync().ConfigureAwait(false);
3134
}
3235

33-
protected async Task<ResourceGroupResource> CreateResourceGroup(SubscriptionResource subscription, string rgNamePrefix, AzureLocation location)
36+
protected async Task<ResourceGroupResource> CreateResourceGroupAsync()
3437
{
35-
string rgName = Recording.GenerateAssetName(rgNamePrefix);
36-
ResourceGroupData input = new ResourceGroupData(location);
37-
var lro = await subscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, rgName, input);
38-
return lro.Value;
38+
var resourceGroupName = Recording.GenerateAssetName("testRG-");
39+
var rgOp = await DefaultSubscription.GetResourceGroups().CreateOrUpdateAsync(
40+
WaitUntil.Completed,
41+
resourceGroupName,
42+
new ResourceGroupData(DefaultLocation)
43+
{
44+
Tags =
45+
{
46+
{ "test", "env" }
47+
}
48+
});
49+
return rgOp.Value;
3950
}
4051
}
4152
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,35 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2+
<ItemGroup>
3+
<PackageReference Include="Azure.ResourceManager.EventHubs" />
4+
<PackageReference Include="Azure.ResourceManager.Network" />
5+
</ItemGroup>
26
<ItemGroup>
37
<ProjectReference Include="..\src\Azure.ResourceManager.ApiManagement.csproj" />
48
</ItemGroup>
9+
<ItemGroup>
10+
<None Update="Resources\apiissueattachment.JPG">
11+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
12+
</None>
13+
<None Update="Resources\petstore.yaml">
14+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
15+
</None>
16+
<None Update="Resources\petstoreOpenApi.json">
17+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
18+
</None>
19+
<None Update="Resources\sdktest.cer">
20+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
21+
</None>
22+
<None Update="Resources\SwaggerInfoTos.json">
23+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
24+
</None>
25+
<None Update="Resources\SwaggerPetStoreV2.json">
26+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
27+
</None>
28+
<None Update="Resources\WADLYahoo.xml">
29+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
30+
</None>
31+
<None Update="Resources\Weather.wsdl">
32+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
33+
</None>
34+
</ItemGroup>
535
</Project>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"swagger": "2.0",
3+
"info": {
4+
"title": "\" + apiId + @\"",
5+
"version": "1.0.0",
6+
"termsOfService": "https://contoso.com/tos",
7+
"contact": {
8+
"name": "Bob",
9+
"url": "https://contoso.com/bob",
10+
"email": "[email protected]"
11+
},
12+
"license": {
13+
"name": "Contoso license",
14+
"url": "https://contoso.com/license"
15+
}
16+
},
17+
"paths": {}
18+
}
19+

0 commit comments

Comments
 (0)