Skip to content

Commit c555143

Browse files
committed
2 parents 2a03ef9 + c951c29 commit c555143

File tree

5 files changed

+566
-2
lines changed

5 files changed

+566
-2
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.Resources.Test/Commands.Resources.Test.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,9 @@
402402
<None Include="SessionRecords\Microsoft.Azure.Commands.Resources.Test.ScenarioTests.ResourceGroupTests\TestRemoveNonExistingResourceGroup.json">
403403
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
404404
</None>
405+
<None Include="SessionRecords\Microsoft.Azure.Commands.Resources.Test.ScenarioTests.ResourceGroupTests\TestResourceGroupWithPositionalParams.json">
406+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
407+
</None>
405408
<None Include="SessionRecords\Microsoft.Azure.Commands.Resources.Test.ScenarioTests.ResourceGroupTests\TestUpdatesExistingResourceGroup.json">
406409
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
407410
</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)