Skip to content

Commit da3d809

Browse files
committed
Merge pull request #46 from MabOneSdk/mkherani
Added powershell test cases for registration
2 parents 01f823f + 535f6d1 commit da3d809

File tree

7 files changed

+91
-11
lines changed

7 files changed

+91
-11
lines changed

src/AzurePowershell.sln

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Microsoft Visual Studio Solution File, Format Version 12.00
2-
# Visual Studio Express 2013 for Web
2+
# Visual Studio 2013
33
VisualStudioVersion = 12.0.31101.0
44
MinimumVisualStudioVersion = 10.0.40219.1
55
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8531411A-0137-4E27-9C5E-49E07C245048}"
@@ -212,6 +212,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ApiManagement.Test
212212
EndProject
213213
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.AzureBackup", "ResourceManager\AzureBackup\Commands.AzureBackup\Commands.AzureBackup.csproj", "{6C8D2337-C9D1-4F52-94B3-AB63A19F3453}"
214214
EndProject
215+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.AzureBackup.Test", "ResourceManager\AzureBackup\Commands.AzureBackup.Test\Commands.AzureBackup.Test.csproj", "{678AE95D-2364-47D7-888C-3FFA6D412CC8}"
216+
EndProject
215217
Global
216218
GlobalSection(SolutionConfigurationPlatforms) = preSolution
217219
Debug|Any CPU = Debug|Any CPU
@@ -518,6 +520,10 @@ Global
518520
{6C8D2337-C9D1-4F52-94B3-AB63A19F3453}.Debug|Any CPU.Build.0 = Debug|Any CPU
519521
{6C8D2337-C9D1-4F52-94B3-AB63A19F3453}.Release|Any CPU.ActiveCfg = Release|Any CPU
520522
{6C8D2337-C9D1-4F52-94B3-AB63A19F3453}.Release|Any CPU.Build.0 = Release|Any CPU
523+
{678AE95D-2364-47D7-888C-3FFA6D412CC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
524+
{678AE95D-2364-47D7-888C-3FFA6D412CC8}.Debug|Any CPU.Build.0 = Debug|Any CPU
525+
{678AE95D-2364-47D7-888C-3FFA6D412CC8}.Release|Any CPU.ActiveCfg = Release|Any CPU
526+
{678AE95D-2364-47D7-888C-3FFA6D412CC8}.Release|Any CPU.Build.0 = Release|Any CPU
521527
EndGlobalSection
522528
GlobalSection(SolutionProperties) = preSolution
523529
HideSolutionNode = FALSE
@@ -559,5 +565,6 @@ Global
559565
{5764A3A4-586C-4536-8481-13007CAC111B} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
560566
{59D1B5DC-9175-43EC-90C6-CBA601B3565F} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
561567
{BEC9ECE9-A3D6-4B24-A682-1FA890647D9D} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
568+
{678AE95D-2364-47D7-888C-3FFA6D412CC8} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
562569
EndGlobalSection
563570
EndGlobal

src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@
3939
<SpecificVersion>False</SpecificVersion>
4040
<HintPath>..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.25-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll</HintPath>
4141
</Reference>
42+
<Reference Include="Microsoft.Azure.Management.BackupServicesManagment">
43+
<HintPath>..\..\..\..\..\azure-sdk-for-net\src\ResourceManagement\AzureBackup\BackupServicesManagment\bin\Net45-Debug\Microsoft.Azure.Management.BackupServicesManagment.dll</HintPath>
44+
</Reference>
4245
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
4346
<SpecificVersion>False</SpecificVersion>
4447
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll</HintPath>
@@ -80,9 +83,6 @@
8083
<Reference Include="Microsoft.WindowsAzure.Management">
8184
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.4.1.1\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
8285
</Reference>
83-
<Reference Include="Microsoft.WindowsAzure.Management.BackupServicesManagment">
84-
<HintPath>..\..\..\..\..\azure-sdk-for-net\src\ResourceManagement\AzureBackup\BackupServicesManagment\bin\Net45-Release\Microsoft.WindowsAzure.Management.BackupServicesManagment.dll</HintPath>
85-
</Reference>
8686
<Reference Include="Microsoft.WindowsAzure.Testing, Version=1.0.5417.13285, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
8787
<SpecificVersion>False</SpecificVersion>
8888
<HintPath>..\..\..\packages\Hydra.SpecTestSupport.1.0.5417.13285-prerelease\lib\net45\Microsoft.WindowsAzure.Testing.dll</HintPath>
@@ -129,6 +129,7 @@
129129
<Compile Include="Properties\AssemblyInfo.cs" />
130130
<Compile Include="ScenarioTests\BackupItemTests.cs" />
131131
<Compile Include="ScenarioTests\AzureBackupJobTests.cs" />
132+
<Compile Include="ScenarioTests\ContainerTest\AzureBackupContainerTest.cs" />
132133
<Compile Include="ScenarioTests\RecoveryPointTests.cs" />
133134
</ItemGroup>
134135
<ItemGroup>
@@ -167,6 +168,7 @@
167168
<None Include="ScenarioTests\AzureBackupJobTests.ps1">
168169
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
169170
</None>
171+
<None Include="ScenarioTests\ContainerTest\AzureBackupContainerTest.ps1" />
170172
<None Include="ScenarioTests\RecoveryPointTests.ps1">
171173
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
172174
</None>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
16+
using Xunit;
17+
18+
namespace Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests
19+
{
20+
public class AzureBackupContainerTest : AzureBackupTestsBase
21+
{
22+
[Fact]
23+
public void RegisterAzureBackupContainerTest()
24+
{
25+
this.RunPowerShellTest("Test-RegisterAzureBackupContainer");
26+
}
27+
28+
[Fact]
29+
public void UnregisterAzureBackupContainerTest()
30+
{
31+
this.RunPowerShellTest("Test-UnregisterAzureBackupContainer");
32+
}
33+
}
34+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# ----------------------------------------------------------------------------------
2+
#
3+
# Copyright Microsoft Corporation
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
# ----------------------------------------------------------------------------------
14+
15+
$ResourceGroupName = "backuprg"
16+
$ResourceName = "backuprn"
17+
$Name = "dev01testing"
18+
$VMServiceName = "dev01testing"
19+
$ContainerType = "IaasVMContainer"
20+
$Location = "westus"
21+
22+
<#
23+
.SYNOPSIS
24+
Tests to register the container
25+
#>
26+
function Test-RegisterAzureBackupContainer
27+
{
28+
$jobId = Register-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -location $Location -Name $VMName -ServiceName $VMServiceName
29+
30+
Assert-NotNull $jobId 'JobID should not be null';
31+
}
32+
33+
function Test-UnregisterAzureBackupContainer
34+
{
35+
$container = Get-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -location $Location -ContainerResourceName $VMName -ContainerResourceGroupName $VMServiceName
36+
$jobId = Unregister-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -location $Location -AzureBackupContainer $container
37+
38+
Assert-NotNull $jobId 'JobID should not be null';
39+
}

src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Container/RegisterAzureBackupContainer.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@
2020
using System.Management.Automation;
2121
using System.Text;
2222
using System.Threading.Tasks;
23-
using Microsoft.Azure.Commands.Compute;
2423
using Microsoft.Azure.Management.BackupServices.Models;
2524
using MBS = Microsoft.Azure.Management.BackupServices;
26-
using Microsoft.Azure.Commands.Compute.Models;
2725
using Microsoft.WindowsAzure.Commands.ServiceManagement.Model;
2826

2927
namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets

src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Container/UnregisterAzureBackupContainer.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@
2020
using System.Management.Automation;
2121
using System.Text;
2222
using System.Threading.Tasks;
23-
using Microsoft.Azure.Commands.Compute;
2423
using Microsoft.Azure.Management.BackupServices.Models;
2524
using MBS = Microsoft.Azure.Management.BackupServices;
26-
using Microsoft.Azure.Commands.Compute.Models;
2725

2826
namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets
2927
{

src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@
6565
<Reference Include="Microsoft.Azure.Common.NetFramework">
6666
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll</HintPath>
6767
</Reference>
68+
<Reference Include="Microsoft.Azure.Management.BackupServicesManagment">
69+
<HintPath>..\..\..\..\..\azure-sdk-for-net\src\ResourceManagement\AzureBackup\BackupServicesManagment\bin\Net45-Debug\Microsoft.Azure.Management.BackupServicesManagment.dll</HintPath>
70+
</Reference>
6871
<Reference Include="Microsoft.Azure.ResourceManager">
6972
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll</HintPath>
7073
</Reference>
@@ -86,9 +89,6 @@
8689
<Reference Include="Microsoft.WindowsAzure.Management">
8790
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.4.1.1\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
8891
</Reference>
89-
<Reference Include="Microsoft.WindowsAzure.Management.BackupServicesManagment">
90-
<HintPath>..\..\..\..\..\..\azure-sdk-for-net\src\ResourceManagement\AzureBackup\BackupServicesManagment\bin\Net40-Debug\Microsoft.WindowsAzure.Management.BackupServicesManagment.dll</HintPath>
91-
</Reference>
9292
<Reference Include="Microsoft.WindowsAzure.Management.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
9393
<SpecificVersion>False</SpecificVersion>
9494
<HintPath>Cmdlets\VaultCredentials\Microsoft.WindowsAzure.Management.Common.dll</HintPath>
@@ -134,6 +134,8 @@
134134
<Compile Include="AzureBackupCmdletBase.cs" />
135135
<Compile Include="AzureBackupCmdletHelpMessage.cs" />
136136
<Compile Include="Cmdlets\BackUp\TriggerBackUp.cs" />
137+
<Compile Include="Cmdlets\Container\RegisterAzureBackupContainer.cs" />
138+
<Compile Include="Cmdlets\Container\UnregisterAzureBackupContainer.cs" />
137139
<Compile Include="Cmdlets\DataSource\Disable-AzureBackupProtection .cs" />
138140
<Compile Include="Cmdlets\DataSource\Enable-AzureBackupProtection .cs" />
139141
<Compile Include="Cmdlets\DataSource\GetAzureBackupItem.cs" />

0 commit comments

Comments
 (0)