Skip to content

Commit b007564

Browse files
committed
removed hardcoding in the tests; removed unnecessary references, added updated json files
Added test cases to the targets file changed the dll version for microsoft.azure.common to 14 to make the failing test pass
1 parent 05ba243 commit b007564

File tree

9 files changed

+1358
-93
lines changed

9 files changed

+1358
-93
lines changed

AzurePowershell.Test.targets

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<DataFactoryManagerTestDebug>.\src\ResourceManager\DataFactories\Commands.DataFactories.Test\bin\Debug\Microsoft.Azure.Commands.DataFactories.Test.dll</DataFactoryManagerTestDebug>
1717
<StreamAnalyticsManagerTestDebug>.\src\ResourceManager\StreamAnalytics\Commands.StreamAnalytics.Test\bin\Debug\Microsoft.Azure.Commands.StreamAnalytics.Test.dll</StreamAnalyticsManagerTestDebug>
1818
<BatchTestDebug>.\src\ResourceManager\Batch\Commands.Batch.Test\bin\Debug\Microsoft.Azure.Commands.Batch.Test.dll</BatchTestDebug>
19+
<WebsitesTestDebug>.\src\ResourceManager\Websites\Commands.Websites.Test\bin\Debug\Microsoft.Azure.Commands.Websites.Test.dll</WebsitesTestDebug>
1920
<ServiceManagementTestDebug>.\src\ServiceManagement\Compute\Commands.ServiceManagement.Test\bin\Debug\Microsoft.WindowsAzure.Commands.ServiceManagement.Test.dll</ServiceManagementTestDebug>
2021
<ServiceManagementExtensionsTestDebug>.\src\ServiceManagement\Compute\Commands.ServiceManagement.Extensions.Test\bin\Debug\Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions.Test.dll</ServiceManagementExtensionsTestDebug>
2122
<SqlDatabaseTestDebug>.\src\ServiceManagement\Sql\Commands.SqlDatabase.Test\bin\Debug\Microsoft.WindowsAzure.Commands.SqlDatabase.Test.dll</SqlDatabaseTestDebug>
@@ -40,6 +41,7 @@
4041
<XUnitTests Include=".\src\ResourceManager\DataFactories\Commands.DataFactories.Test\bin\Debug\Microsoft.Azure.Commands.DataFactories.Test.dll"/>
4142
<XUnitTests Include=".\src\ResourceManager\StreamAnalytics\Commands.StreamAnalytics.Test\bin\Debug\Microsoft.Azure.Commands.StreamAnalytics.Test.dll"/>
4243
<XUnitTests Include=".\src\ResourceManager\Batch\Commands.Batch.Test\bin\Debug\Microsoft.Azure.Commands.Batch.Test.dll"/>
44+
<XUnitTests Include=".\src\ResourceManager\Websites\Commands.Websites.Test\bin\Debug\Microsoft.Azure.Commands.Websites.Test.dll"/>
4345
<XUnitTests Include=".\src\ResourceManager\KeyVault\Commands.KeyVault.Test\bin\Debug\Microsoft.Azure.Commands.KeyVault.Test.dll"/>
4446
<XUnitTests Include=".\src\ServiceManagement\ManagedCache\Commands.ManagedCache.Test\bin\Debug\Microsoft.Azure.Commands.ManagedCache.Test.dll"/>
4547
<XUnitTests Include=".\src\Common\Commands.ScenarioTest\bin\Debug\Microsoft.WindowsAzure.Commands.ScenarioTest.dll"/>
@@ -90,6 +92,12 @@
9092
ExcludeTraits="$(XUnitExcludedTrait)" MaxParallelThreads="0" ParallelizeAssemblies="false" ParallelizeTestCollections="false" />
9193
</Target>
9294

95+
96+
<Target Name="TestWebsites">
97+
<Xunit.Runner.MSBuild.xunit Assemblies="$(WebsitesTestDebug)" Html="$(TestOutputDirectory)\WebsitesTestDebug.xunit.dll.html" Verbose="false"
98+
ExcludeTraits="$(XUnitExcludedTrait)" MaxParallelThreads="0" ParallelizeAssemblies="false" ParallelizeTestCollections="false" />
99+
</Target>
100+
93101
<Target Name="TestDataFactoryManager">
94102
<Xunit.Runner.MSBuild.xunit Assemblies="$(DataFactoryManagerTestDebug)" Html="$(TestOutputDirectory)\DataFactoryManagerTestDebug.xunit.dll.html" Verbose="false"
95103
ExcludeTraits="$(XUnitExcludedTrait)" MaxParallelThreads="0" ParallelizeAssemblies="false" ParallelizeTestCollections="false" />

src/Common/Commands.ScenarioTests.Common/Commands.ScenarioTests.Common.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,6 @@
129129
<None Include="packages.config" />
130130
</ItemGroup>
131131
<ItemGroup>
132-
<ProjectReference Include="..\..\ResourceManager\Websites\Commands.Websites\Commands.Websites.csproj">
133-
<Project>{80a92297-7c92-456b-8ee7-9fb6ce30149d}</Project>
134-
<Name>Commands.Websites</Name>
135-
</ProjectReference>
136132
<ProjectReference Include="..\..\ServiceManagement\Services\Commands.Test.Utilities\Commands.Test.Utilities.csproj">
137133
<Project>{bc420543-c04e-4bf3-96e1-cd81b823bdd7}</Project>
138134
<Name>Commands.Test.Utilities</Name>

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
</Reference>
4747
<Reference Include="Microsoft.Azure.Common.Authentication">
4848
<SpecificVersion>False</SpecificVersion>
49-
<HintPath>..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.13-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll</HintPath>
49+
<HintPath>..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.14-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll</HintPath>
5050
</Reference>
5151
<Reference Include="Microsoft.Azure.Common.NetFramework">
5252
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll</HintPath>
@@ -83,10 +83,6 @@
8383
<SpecificVersion>False</SpecificVersion>
8484
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll</HintPath>
8585
</Reference>
86-
<Reference Include="Microsoft.WindowsAzure.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
87-
<SpecificVersion>False</SpecificVersion>
88-
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.4.0.1\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
89-
</Reference>
9086
<Reference Include="Moq">
9187
<HintPath>..\..\..\packages\Moq.4.2.1402.2112\lib\net40\Moq.dll</HintPath>
9288
</Reference>

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,29 @@ Gets a website name for testing.
1818
#>
1919
function Get-WebsiteName
2020
{
21+
# need to remove hardcoding
22+
return getAssetName
23+
}
24+
25+
<#
26+
.SYNOPSIS
27+
Gets a website name for testing.
28+
#>
29+
function Get-WebHostPlanName
30+
{
2131
# need to remove hardcoding
2232
return getAssetName
2333
}
2434

35+
<#
36+
.SYNOPSIS
37+
Gets a resource group name for testing.
38+
#>
39+
function Get-ResourceGroupName
40+
{
41+
return getAssetName
42+
}
43+
2544
<#
2645
.SYNOPSIS
2746
Gets the location for the Website. Default to West US if none found.

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

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,32 @@ Tests creating a new website.
1919
function Test-CreatesNewSimpleWebsite
2020
{
2121
# Setup
22-
$rgname = "Default-Web-WestUS"
23-
$wname = "ngoliPSWebsite"
24-
$location = "West US"
25-
$webHostingPlan = "NGoliStandard"
22+
$rgname = Get-ResourceGroupName
23+
$wname = Get-WebsiteName
24+
$location = Get-Location
25+
$whpName = Get-WebHostPlanName
2626
$apiversion = "2014-04-01"
2727
$resourceType = "Microsoft.Web/sites"
2828
try
2929
{
30-
# Test
31-
$actual = New-AzureWebsite -ResourceGroupName $rgname -WebsiteName $wname -Location $location -WebHostingPlan $webHostingPlan
32-
$result = Get-AzureWebsite -ResourceGroupName $rgname -WebsiteName $wname
30+
#Setup
31+
New-AzureResourceGroup -Name $rgname -Location $location
32+
New-AzureWebHostingPlan -ResourceGroupName $rgname -WebHostingPlanName $whpName -location $location
3333

34-
# Assert
35-
Assert-AreEqual $wname $result.Properties.RepositorySiteName
36-
Assert-AreEqual $webHostingPlan $result.Properties.ServerFarm
34+
# Test
35+
$actual = New-AzureWebsite -ResourceGroupName $rgname -WebsiteName $wname -Location $location -WebHostingPlan $whpName
36+
$result = Get-AzureWebsite -ResourceGroupName $rgname -WebsiteName $wname
37+
38+
# Assert
39+
Assert-AreEqual $wname $result.Name
40+
Assert-AreEqual $whpName $result.Properties.ServerFarm
3741
}
3842
finally
39-
{
40-
# Cleanup
41-
#Clean-Website($rgname,$wname)
42-
Remove-AzureWebsite -ResourceGroupName $rgname -WebsiteName $wname -Force
43+
{
44+
# Cleanup
45+
Remove-AzureWebsite -ResourceGroupName $rgname -WebsiteName $wname -Force
46+
Remove-AzureWebHostingPlan -ResourceGroupName $rgname -WebHostingPlanName $whpName -Force
47+
Remove-AzureResourceGroup -Name $rgname -Force
4348
}
4449
}
4550

@@ -50,23 +55,27 @@ Tests creating a new Web Hosting Plan.
5055
function Test-CreatesNewWebHostingPlan
5156
{
5257
# Setup
53-
$rgname = "Default-Web-WestUS"
54-
$whpName = "ngoliPSWHP"
55-
$location = "West US"
58+
$rgname = Get-ResourceGroupName
59+
$whpName = Get-WebHostPlanName
60+
$location = Get-Location
61+
5662
try
5763
{
58-
# Test
59-
$actual = New-AzureWebHostingPlan -ResourceGroupName $rgname -WebHostingPlanName $whpName -location $location
60-
$result = Get-AzureWebHostingPlan -ResourceGroupName $rgname -WebHostingPlanName $whpName
61-
# Assert
62-
Assert-AreEqual $whpName $result.WebHostingPlan.Name
63-
Assert-AreEqual 1 $result.WebHostingPlan.Properties.NumberOfWorkers
64-
Assert-AreEqual "Standard" $result.WebHostingPlan.Properties.Sku
65-
Assert-AreEqual "Small" $result.WebHostingPlan.Properties.WorkerSize
64+
#Setup
65+
New-AzureResourceGroup -Name $rgname -Location $location
66+
# Test
67+
$actual = New-AzureWebHostingPlan -ResourceGroupName $rgname -WebHostingPlanName $whpName -location $location
68+
$result = Get-AzureWebHostingPlan -ResourceGroupName $rgname -WebHostingPlanName $whpName
69+
# Assert
70+
Assert-AreEqual $whpName $result.WebHostingPlan.Name
71+
Assert-AreEqual 1 $result.WebHostingPlan.Properties.NumberOfWorkers
72+
Assert-AreEqual "Standard" $result.WebHostingPlan.Properties.Sku
73+
Assert-AreEqual "Small" $result.WebHostingPlan.Properties.WorkerSize
6674
}
6775
finally
6876
{
69-
# Cleanup
70-
Remove-AzureWebHostingPlan -ResourceGroupName $rgname -WebHostingPlanName $whpName -Force
77+
# Cleanup
78+
Remove-AzureWebHostingPlan -ResourceGroupName $rgname -WebHostingPlanName $whpName -Force
79+
Remove-AzureResourceGroup -Name $rgname -Force
7180
}
7281
}

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebsitesTests/TestCreatesNewSimpleWebsite.json

Lines changed: 708 additions & 30 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebsitesTests/TestCreatesNewWebHostingPlan.json

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<packages>
33
<package id="Hyak.Common" version="1.0.2" targetFramework="net45" />
44
<package id="Microsoft.Azure.Common" version="2.0.2" targetFramework="net45" />
5-
<package id="Microsoft.Azure.Common.Authentication" version="1.0.13-preview" targetFramework="net45" />
5+
<package id="Microsoft.Azure.Common.Authentication" version="1.0.14-preview" targetFramework="net45" />
66
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
77
<package id="Microsoft.Azure.Common.Extensions" version="0.14.0-preview" targetFramework="net45" />
88
<package id="Microsoft.Azure.Gallery" version="2.6.0-preview" targetFramework="net45" />

src/ResourceManager/Websites/Commands.Websites/Cmdlets/WebHostingPlan/RemoveWebHostingPlan.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
using Microsoft.Azure;
3232
using Microsoft.WindowsAzure.Commands.Utilities.Common;
3333
using Microsoft.Azure.Commands.Websites.Utilities;
34-
using Microsoft.WindowsAzure.Commands.Utilities.Properties;
3534

3635

3736
namespace Microsoft.Azure.Commands.Websites.Cmdlets.WebHostingPlan

0 commit comments

Comments
 (0)