Skip to content

Commit 2f7d50a

Browse files
author
REDMOND\chanwan
committed
Test of random resoure group name
1 parent fc4dae9 commit 2f7d50a

File tree

4 files changed

+25
-8
lines changed

4 files changed

+25
-8
lines changed

src/ResourceManager/Consumption/Commands.Consumption.Test/Commands.Consumption.Test.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@
6565
<Reference Include="Microsoft.Azure.Management.Consumption, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
6666
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Consumption.3.0.1\lib\net452\Microsoft.Azure.Management.Consumption.dll</HintPath>
6767
</Reference>
68-
<Reference Include="Microsoft.Azure.Management.ResourceManager.Fluent, Version=1.0.0.60, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
69-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.ResourceManager.Fluent.1.11.1\lib\net452\Microsoft.Azure.Management.ResourceManager.Fluent.dll</HintPath>
70-
<Private>True</Private>
68+
<Reference Include="Microsoft.Azure.Management.ResourceManager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
69+
<SpecificVersion>False</SpecificVersion>
70+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.ResourceManager.1.6.0-preview\lib\net452\Microsoft.Azure.Management.ResourceManager.dll</HintPath>
7171
</Reference>
7272
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
7373
<SpecificVersion>False</SpecificVersion>

src/ResourceManager/Consumption/Commands.Consumption.Test/ScenarioTests/BudgetTests.ps1

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@ function Get-NotificationKey
3737
return "NotificationKey-" + (getAssetName)
3838
}
3939

40+
<#
41+
.SYNOPSIS
42+
Get Resource Group Name
43+
#>
44+
function Get-ResourceGroupName
45+
{
46+
return "RG-" + (getAssetName)
47+
}
48+
4049
<#
4150
.SYNOPSIS
4251
Test budget at subscription level
@@ -94,10 +103,15 @@ function Test-BudgetAtResourceGroupLevel
94103
$notificationKey1 = Get-NotificationKey
95104
$notificationKey2 = Get-NotificationKey
96105
# This resource group is created at the scope of test subscription
97-
$resourceGroupName = 'RGBudgets'
106+
$resourceGroupName = Get-ResourceGroupName
98107
$startDate = Get-Date -Day 1
99108
$endDate = ($startDate).AddMonths(3).AddDays(-1)
100109

110+
# Create Resource Group
111+
Install-Module -Name AzureRm.Resources -Force
112+
Import-Module -Name AzureRm.Resources
113+
New-AzureRmResourceGroup -Name $resourceGroupName -Location westus -Force
114+
101115
# Create budget
102116
Write-Debug "Create a new budget $budgetName at resource group level"
103117
$budgetNew = New-AzureRmConsumptionBudget -Amount 6000 -Name $budgetName -ResourceGroupName $resourceGroupName -Category Cost -StartDate $startDate -EndDate $endDate -TimeGrain Monthly
@@ -135,6 +149,9 @@ function Test-BudgetAtResourceGroupLevel
135149
Assert-AreEqual True $response
136150

137151
Assert-Throws {Get-AzureRmConsumptionBudget -Name $budgetName -ResourceGroupName $resourceGroupName}
152+
153+
# Remove Resource Group
154+
Remove-AzureRmResourceGroup -Name $resourceGroupName
138155
}
139156

140157
<#

src/ResourceManager/Consumption/Commands.Consumption.Test/ScenarioTests/TestController.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class TestController : RMTestBase
4141

4242
public ResourceManagementClient ResourceManagementClient { get; private set; }
4343

44-
public RM.Fluent.ResourceManagementClient ResourceClient { get; private set; }
44+
public RM.ResourceManagementClient ResourceClient { get; private set; }
4545

4646
public SubscriptionClient SubscriptionClient { get; private set; }
4747

@@ -165,10 +165,10 @@ protected ResourceManagementClient GetResourceManagementClient()
165165
return TestBase.GetServiceClient<ResourceManagementClient>(_csmTestFactory);
166166
}
167167

168-
private RM.Fluent.ResourceManagementClient GetResourceClient(MockContext context)
168+
private RM.ResourceManagementClient GetResourceClient(MockContext context)
169169
{
170170
return
171-
context.GetServiceClient<RM.Fluent.ResourceManagementClient>(
171+
context.GetServiceClient<RM.ResourceManagementClient>(
172172
Rest.ClientRuntime.Azure.TestFramework.TestEnvironmentFactory.GetTestEnvironment());
173173
}
174174

src/ResourceManager/Consumption/Commands.Consumption.Test/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<package id="Microsoft.Azure.Gallery" version="2.6.2-preview" targetFramework="net45" />
77
<package id="Microsoft.Azure.Management.Authorization" version="1.0.0" targetFramework="net45" />
88
<package id="Microsoft.Azure.Management.Consumption" version="3.0.1" targetFramework="net452" />
9-
<package id="Microsoft.Azure.Management.ResourceManager.Fluent" version="1.11.1" targetFramework="net452" />
9+
<package id="Microsoft.Azure.Management.ResourceManager" version="1.6.0-preview" targetFramework="net452" />
1010
<package id="Microsoft.Azure.Management.Resources" version="2.20.0-preview" targetFramework="net45" />
1111
<package id="Microsoft.Azure.Test.Framework" version="1.0.6179.26854-prerelease" targetFramework="net45" />
1212
<package id="Microsoft.Azure.Test.HttpRecorder" version="1.6.7-preview" targetFramework="net45" />

0 commit comments

Comments
 (0)