Skip to content

Commit 800718a

Browse files
committed
Adding a testcase for creating App Service plan in Ase
1 parent 17a48bf commit 800718a

File tree

4 files changed

+728
-0
lines changed

4 files changed

+728
-0
lines changed

src/ResourceManager/Websites/Commands.Websites.Test/Commands.Websites.Test.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@
171171
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.AppServicePlanTests\TestCreateNewAppServicePlan.json">
172172
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
173173
</None>
174+
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.AppServicePlanTests\TestCreateNewAppServicePlanInAse.json">
175+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
176+
</None>
174177
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.AppServicePlanTests\TestGetAppServicePlan.json">
175178
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
176179
</None>

src/ResourceManager/Websites/Commands.Websites.Test/ScenarioTests/AppServicePlanTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,12 @@ public void TestGetAppServicePlanMetrics()
5555
{
5656
WebsitesController.NewInstance.RunPsTest("Test-GetAppServicePlanMetrics");
5757
}
58+
59+
[Fact]
60+
[Trait(Category.AcceptanceType, Category.CheckIn)]
61+
public void TestCreateNewAppServicePlanInAse()
62+
{
63+
WebsitesController.NewInstance.RunPsTest("Test-CreateNewAppServicePlanInAse");
64+
}
5865
}
5966
}

src/ResourceManager/Websites/Commands.Websites.Test/ScenarioTests/AppServicePlanTests.ps1

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,4 +309,49 @@ function Test-GetAppServicePlanMetrics
309309
Remove-AzureRmAppServicePlan -ResourceGroupName $rgname -Name $appServicePlanName -Force
310310
Remove-AzureRmResourceGroup -Name $rgname -Force
311311
}
312+
}
313+
314+
<#
315+
.SYNOPSIS
316+
Tests creating a new Web Hosting Plan.
317+
#>
318+
function Test-CreateNewAppServicePlanInAse
319+
{
320+
# Setup
321+
$rgname = Get-ResourceGroupName
322+
$whpName = Get-WebHostPlanName
323+
$location = "West US"
324+
$capacity = 1
325+
$skuName = "S2"
326+
$aseName = "asedemo"
327+
$aseResourceGroupName = "appdemorg"
328+
329+
try
330+
{
331+
#Setup
332+
New-AzureRmResourceGroup -Name $rgname -Location $location
333+
334+
# Test
335+
$createResult = New-AzureRmAppServicePlan -ResourceGroupName $rgname -Name $whpName -Location $location -Tier "Standard" -WorkerSize Medium -NumberOfWorkers $capacity -AseName $aseName -AseResourceGroupName $aseResourceGroupName
336+
337+
# Assert
338+
Assert-AreEqual $whpName $createResult.Name
339+
Assert-AreEqual "Standard" $createResult.Sku.Tier
340+
Assert-AreEqual $skuName $createResult.Sku.Name
341+
Assert-AreEqual $capacity $createResult.Sku.Capacity
342+
343+
# Assert
344+
345+
$getResult = Get-AzureRmAppServicePlan -ResourceGroupName $rgname -Name $whpName
346+
Assert-AreEqual $whpName $getResult.Name
347+
Assert-AreEqual "Standard" $getResult.Sku.Tier
348+
Assert-AreEqual $skuName $getResult.Sku.Name
349+
Assert-AreEqual $capacity $getResult.Sku.Capacity
350+
}
351+
finally
352+
{
353+
# Cleanup
354+
Remove-AzureRmAppServicePlan -ResourceGroupName $rgname -Name $whpName -Force
355+
Remove-AzureRmResourceGroup -Name $rgname -Force
356+
}
312357
}

0 commit comments

Comments
 (0)