Skip to content

Commit 9f5fa2a

Browse files
committed
update test for add-azurevmimage
1 parent 2777c20 commit 9f5fa2a

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTestCommonVhd.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,14 @@ public void AzureVMImageTest()
148148

149149
string oldLabel = "old label";
150150
string newLabel = "new label";
151+
string vmSize = "Small";
152+
var iconUri = "http://www.bing.com";
153+
var smallIconUri = "http://www.bing.com";
154+
bool showInGui = true;
151155

152156
try
153157
{
154-
OSImageContext result = vmPowershellCmdlets.AddAzureVMImage(newImageName, mediaLocation, OS.Windows, oldLabel);
158+
OSImageContext result = vmPowershellCmdlets.AddAzureVMImage(newImageName, mediaLocation, OS.Windows, oldLabel, vmSize, iconUri, smallIconUri, showInGui);
155159

156160
OSImageContext resultReturned = vmPowershellCmdlets.GetAzureVMImage(newImageName)[0];
157161
Assert.IsTrue(!string.IsNullOrEmpty(resultReturned.IOType));

src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/IaasCmdletInfo/AddAzureVMImageCmdletInfo.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,25 @@ public AddAzureVMImageCmdletInfo(string imageName, string mediaLocation, OS os,
4343
}
4444
}
4545

46+
public AddAzureVMImageCmdletInfo(string imageName, string mediaLocation, OS os, string label, string recommendedSize, string iconUri, string smallIconUri, bool showInGui)
47+
: this(imageName, mediaLocation, os, label, recommendedSize)
48+
{
49+
if (!string.IsNullOrEmpty(iconUri))
50+
{
51+
cmdletParams.Add(new CmdletParam("IconUri", iconUri));
52+
}
53+
54+
if (!string.IsNullOrEmpty(iconUri))
55+
{
56+
cmdletParams.Add(new CmdletParam("SmallIconUri", smallIconUri));
57+
}
58+
59+
if (showInGui)
60+
{
61+
cmdletParams.Add(new CmdletParam("ShowInGui"));
62+
}
63+
}
64+
4665
public AddAzureVMImageCmdletInfo(
4766
string imageName,
4867
string mediaLocation,

src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementCmdletTestHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,11 +1324,11 @@ public ManagementOperationContext UpdateAzureVM(string vmName, string serviceNam
13241324

13251325
#region AzureVMImage
13261326

1327-
public SM.OSImageContext AddAzureVMImage(string imageName, string mediaLocation, OS os, string label = null, string recommendedSize = null)
1327+
public SM.OSImageContext AddAzureVMImage(string imageName, string mediaLocation, OS os, string label = null, string recommendedSize = null, string iconUri = null, string smallIconUri = null, bool showInGui = false)
13281328
{
13291329
SM.OSImageContext result = new SM.OSImageContext();
13301330
Utilities.RetryActionUntilSuccess(
1331-
() => result = RunPSCmdletAndReturnFirst<SM.OSImageContext>(new AddAzureVMImageCmdletInfo(imageName, mediaLocation, os, label, recommendedSize)),
1331+
() => result = RunPSCmdletAndReturnFirst<SM.OSImageContext>(new AddAzureVMImageCmdletInfo(imageName, mediaLocation, os, label, recommendedSize, iconUri, smallIconUri, showInGui)),
13321332
"409", 3, 60);
13331333
return result;
13341334
}

0 commit comments

Comments
 (0)