Skip to content

Commit 5ecea53

Browse files
StrategiesVirtualMachineTests
1 parent 49bffe2 commit 5ecea53

File tree

3 files changed

+65
-0
lines changed

3 files changed

+65
-0
lines changed

src/ResourceManager/Compute/Commands.Compute.Test/Commands.Compute.Test.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@
195195
<DependentUpon>Resources.resx</DependentUpon>
196196
</Compile>
197197
<Compile Include="Properties\AssemblyInfo.cs" />
198+
<Compile Include="ScenarioTests\StrategiesVirtualMachineTests.cs" />
198199
</ItemGroup>
199200
<ItemGroup>
200201
<ProjectReference Include="..\..\..\Common\Commands.Common.Authentication.Abstractions\Commands.Common.Authentication.Abstractions.csproj">
@@ -358,6 +359,9 @@
358359
<None Include="SessionRecords\**\*.json">
359360
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
360361
</None>
362+
<None Include="ScenarioTests\StrategiesVirtualMachineTests.ps1">
363+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
364+
</None>
361365
<None Include="Templates\azuredeploy.json">
362366
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
363367
</None>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using Microsoft.Azure.Commands.Compute.Test.ScenarioTests;
2+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
3+
using Xunit;
4+
5+
namespace Microsoft.Azure.Commands.Compute.Test.ScenarioTests
6+
{
7+
public class StrategiesVirtualMachineTests
8+
{
9+
public StrategiesVirtualMachineTests(Xunit.Abstractions.ITestOutputHelper output)
10+
{
11+
ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
12+
}
13+
14+
[Fact(/*Skip = "TODO: only works for live mode"*/)]
15+
[Trait(Category.RunType, Category.LiveOnly)]
16+
public void TestSimpleNewVm()
17+
{
18+
ComputeTestController.NewInstance.RunPsTest("Test-SimpleNewVm");
19+
}
20+
}
21+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
<#
16+
.SYNOPSIS
17+
Test Simple Paremeter Set for New Vm
18+
#>
19+
function Test-SimpleNewVm
20+
{
21+
# Setup
22+
$vmname = Get-ResourceName
23+
24+
try
25+
{
26+
$username = "domain01\admin01"
27+
$password = "Qwe123Asd456Zxc890!" | ConvertTo-SecureString
28+
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
29+
30+
# Common
31+
$x = New-AzureRmVM -Name $vmname -Credential $cred
32+
33+
Assert-AreEqual $vmname $x.Name;
34+
}
35+
finally
36+
{
37+
# Cleanup
38+
Clean-ResourceGroup $vmname
39+
}
40+
}

0 commit comments

Comments
 (0)