Skip to content

Commit 7edd186

Browse files
author
Hovsep
committed
Merge pull request Azure#2153 from ravbhatnagar/dev
Adding positional params to Resource group cmdlets and updating help
2 parents a1ddf30 + 6c4bdc5 commit 7edd186

File tree

10 files changed

+694
-34
lines changed

10 files changed

+694
-34
lines changed

src/ResourceManager/Resources/AzureRM.Resources.psd1

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,14 @@ RequiredAssemblies = @()
5454
ScriptsToProcess = @()
5555

5656
# Type files (.ps1xml) to be loaded when importing this module
57-
TypesToProcess = @()
57+
TypesToProcess = @(
58+
'Microsoft.Azure.Commands.ResourceManager.Cmdlets.Types.ps1xml'
59+
)
5860

5961
# Format files (.ps1xml) to be loaded when importing this module
6062
FormatsToProcess = @(
61-
'.\Microsoft.Azure.Commands.Resources.format.ps1xml'
63+
'.\Microsoft.Azure.Commands.Resources.format.ps1xml',
64+
'.\Microsoft.Azure.Commands.ResourceManager.Cmdlets.format.ps1xml'
6265
)
6366

6467
# Modules to import as nested modules of the module specified in ModuleToProcess

src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Microsoft.Azure.Commands.ResourceManager.Cmdlets.dll-Help.xml

Lines changed: 78 additions & 25 deletions
Large diffs are not rendered by default.

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,9 @@
409409
<None Include="SessionRecords\Microsoft.Azure.Commands.Resources.Test.ScenarioTests.ResourceGroupTests\TestRemoveNonExistingResourceGroup.json">
410410
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
411411
</None>
412+
<None Include="SessionRecords\Microsoft.Azure.Commands.Resources.Test.ScenarioTests.ResourceGroupTests\TestResourceGroupWithPositionalParams.json">
413+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
414+
</None>
412415
<None Include="SessionRecords\Microsoft.Azure.Commands.Resources.Test.ScenarioTests.ResourceGroupTests\TestUpdatesExistingResourceGroup.json">
413416
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
414417
</None>

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ public void TestExportResourceGroup()
7676
ResourcesController.NewInstance.RunPsTest("Test-ExportResourceGroup");
7777
}
7878

79+
[Fact]
80+
[Trait(Category.AcceptanceType, Category.CheckIn)]
81+
public void TestResourceGroupWithPositionalParams()
82+
{
83+
ResourcesController.NewInstance.RunPsTest("Test-ResourceGroupWithPositionalParams");
84+
}
85+
7986
[Fact (Skip = "TODO: Fix the broken test.")]
8087
public void TestAzureTagsEndToEnd()
8188
{

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,4 +350,34 @@ function Test-ExportResourceGroup
350350
# Cleanup
351351
Clean-ResourceGroup $rgname
352352
}
353+
}
354+
355+
<#
356+
.SYNOPSIS
357+
Tests resource group new, get and remove using positional parameters.
358+
#>
359+
function Test-ResourceGroupWithPositionalParams
360+
{
361+
# Setup
362+
$rgname = Get-ResourceGroupName
363+
$location = "West US"
364+
365+
try
366+
{
367+
$ErrorActionPreference = "SilentlyContinue"
368+
$Error.Clear()
369+
# Test
370+
$actual = New-AzureRmResourceGroup $rgname $location
371+
$expected = Get-AzureRmResourceGroup $rgname
372+
373+
# Assert
374+
Assert-AreEqual $expected.ResourceGroupName $actual.ResourceGroupName
375+
376+
#Test
377+
Remove-AzureRmResourceGroup $rgname -Force
378+
}
379+
catch
380+
{
381+
Assert-True { $Error[0].Contains("Provided resource group does not exist.") }
382+
}
353383
}

0 commit comments

Comments
 (0)