Skip to content

Added Test and more name changes #315

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 7, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
<None Include="SessionRecords\Microsoft.Azure.Commands.WebApp.Test.ScenarioTests.WebAppTests\TestCreatesNewSimpleWebApp.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.WebApp.Test.ScenarioTests.WebAppTests\TestSetNewAppServicePlan.json" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Common\Commands.Common.Test\Commands.Common.Test.csproj">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ Gets a website name for testing.
#>
function Get-WebsiteName
{
# need to remove hardcoding
return getAssetName
}

Expand All @@ -28,7 +27,6 @@ Gets a website name for testing.
#>
function Get-WebHostPlanName
{
# need to remove hardcoding
return getAssetName
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,12 @@ public void TestCreatesNewAppServicePlan()
{
WebsitesController.NewInstance.RunPsTest("Test-CreatesNewAppServicePlan");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestSetNewAppServicePlan()
{
WebsitesController.NewInstance.RunPsTest("Test-SetNewAppServicePlan");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,47 @@ function Test-CreatesNewAppServicePlan
Remove-AzureAppServicePlan -ResourceGroupName $rgname -Name $whpName -Force
Remove-AzureResourceGroup -Name $rgname -Force
}
}

<#
.SYNOPSIS
Tests creating a new Web Hosting Plan.
#>
function Test-SetNewAppServicePlan
{
# Setup
$rgname = Get-ResourceGroupName
$whpName = Get-WebHostPlanName
$location = Get-Location

try
{
#Setup
New-AzureResourceGroup -Name $rgname -Location $location
# Test
$actual = New-AzureAppServicePlan -ResourceGroupName $rgname -Name $whpName -Location $location
$result = Get-AzureAppServicePlan -ResourceGroupName $rgname -Name $whpName
# Assert
Assert-AreEqual $whpName $result.WebHostingPlan.Name
Assert-AreEqual 1 $result.WebHostingPlan.Properties.NumberOfWorkers
Assert-AreEqual "Standard" $result.WebHostingPlan.Properties.Sku
Assert-AreEqual "Small" $result.WebHostingPlan.Properties.WorkerSize

# Test setting the created service plan
$newresult = Set-AzureAppServicePlan -ResourceGroupName $rgname -Name $whpName -Location $location -Sku Premium -NumberofWorkers 12 -WorkerSize Medium
# due to a bug Set and New are not returning the appropriate object so need to get.
$newresult = Get-AzureAppServicePlan -ResourceGroupName $rgname -Name $whpName

# Assert
Assert-AreEqual $whpName $result.WebHostingPlan.Name
Assert-AreEqual 12 $newresult.WebHostingPlan.Properties.NumberOfWorkers
Assert-AreEqual "Premium" $newresult.WebHostingPlan.Properties.Sku
Assert-AreEqual "Medium" $newresult.WebHostingPlan.Properties.WorkerSize
}
finally
{
# Cleanup
Remove-AzureAppServicePlan -ResourceGroupName $rgname -Name $whpName -Force
Remove-AzureResourceGroup -Name $rgname -Force
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ public override void ExecuteCmdlet()

private void GetByWebHostingPlan()
{
WriteObject(WebsitesClient.GetWebHostingPlan(ResourceGroupName, Name));
WriteObject(WebsitesClient.GetAppServicePlan(ResourceGroupName, Name));
}

private void GetByResourceGroup()
{
WriteObject(WebsitesClient.ListWebHostingPlan(ResourceGroupName));
WriteObject(WebsitesClient.ListAppServicePlan(ResourceGroupName));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public override void ExecuteCmdlet()
}
}

WriteObject(WebsitesClient.CreateWebHostingPlan(ResourceGroupName, Name, Location, adminSiteName, NumberofWorkers, skuInput, workerSizeInput));
WriteObject(WebsitesClient.CreateAppServicePlan(ResourceGroupName, Name, Location, adminSiteName, NumberofWorkers, skuInput, workerSizeInput));

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ public override void ExecuteCmdlet()
{
ConfirmAction(
Force.IsPresent,
string.Format(Microsoft.Azure.Commands.WebApp.Properties.Resources.RemovingWebHostPlan, Name),
Microsoft.Azure.Commands.WebApp.Properties.Resources.RemovingWebHostPlan,
string.Format(Microsoft.Azure.Commands.WebApp.Properties.Resources.RemovingAppServicePlan, Name),
Microsoft.Azure.Commands.WebApp.Properties.Resources.RemovingAppServicePlan,
Name,
() => WebsitesClient.RemoveWebHostingPlan(ResourceGroupName, Name));
() => WebsitesClient.RemoveAppServicePlan(ResourceGroupName, Name));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public override void ExecuteCmdlet()
}
}

WriteObject(WebsitesClient.CreateWebHostingPlan(ResourceGroupName, Name, Location, adminSiteName, NumberofWorkers, skuInput, workerSizeInput));
WriteObject(WebsitesClient.CreateAppServicePlan(ResourceGroupName, Name, Location, adminSiteName, NumberofWorkers, skuInput, workerSizeInput));

}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,16 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="RemovingWebHostPlan" xml:space="preserve">
<value>Are you sure you want to remove web hosting plan '{0}'</value>
<data name="RemovingAppServicePlan" xml:space="preserve">
<value>Are you sure you want to remove app service plan '{0}'</value>
</data>
<data name="RemoveWebsiteMessage" xml:space="preserve">
<value>Removing website</value>
<value>Removing web app</value>
</data>
<data name="RemoveWebsiteWarning" xml:space="preserve">
<value>Are you sure you want to remove the website "{0}"</value>
<value>Are you sure you want to remove the web app "{0}"</value>
</data>
<data name="RemovingWebsite" xml:space="preserve">
<value>Are you sure you want to remove website '{0}'</value>
<value>Are you sure you want to remove web app '{0}'</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public WebSiteGetHistoricalUsageMetricsResponse GetWebAppUsageMetrics(string res
return usageMetrics;
}

public WebHostingPlanCreateOrUpdateResponse CreateWebHostingPlan(string resourceGroupName, string whpName, string location, string adminSiteName, int numberOfWorkers, SkuOptions sku, WorkerSizeOptions workerSize)
public WebHostingPlanCreateOrUpdateResponse CreateAppServicePlan(string resourceGroupName, string whpName, string location, string adminSiteName, int numberOfWorkers, SkuOptions sku, WorkerSizeOptions workerSize)
{
WebHostingPlanProperties webHostingPlanProperties = new WebHostingPlanProperties();
webHostingPlanProperties.Sku = sku;
Expand All @@ -143,24 +143,21 @@ public WebHostingPlanCreateOrUpdateResponse CreateWebHostingPlan(string resource
return createdWHP;
}

public AzureOperationResponse RemoveWebHostingPlan(string resourceGroupName, string whpName)
public AzureOperationResponse RemoveAppServicePlan(string resourceGroupName, string whpName)
{
var response = WrappedWebsitesClient.WebHostingPlans.Delete(resourceGroupName, whpName);
//proper return type need to be discussed
return response;
}

public WebHostingPlanGetResponse GetWebHostingPlan(string resourceGroupName, string whpName)
public WebHostingPlanGetResponse GetAppServicePlan(string resourceGroupName, string whpName)
{
var response = WrappedWebsitesClient.WebHostingPlans.Get(resourceGroupName, whpName);
//proper return type need to be discussed
return response;
}

public WebHostingPlanListResponse ListWebHostingPlan(string resourceGroupName)
public WebHostingPlanListResponse ListAppServicePlan(string resourceGroupName)
{
var response = WrappedWebsitesClient.WebHostingPlans.List(resourceGroupName);
//proper return type need to be discussed
return response;
}

Expand Down