Skip to content

Commit 583d0b7

Browse files
author
dragonfly91
committed
Merge branch 'release' into dev1
2 parents f43ba56 + d961066 commit 583d0b7

File tree

111 files changed

+23421
-7773
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+23421
-7773
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ This repository contains a set of PowerShell cmdlets for developers and administ
5050

5151
For detail descriptions and examples of the cmdlets, type
5252
* ```help azure``` to get all the cmdlets.
53-
* ```help azurerm``` to get all the Azure Resource Manaber (ARM) cmdlets.
53+
* ```help azurerm``` to get all the Azure Resource Manager (ARM) cmdlets.
5454
* ```help <cmdlet name>``` to get the details of a specific cmdlet.
5555

5656
## Supported Environments
@@ -72,9 +72,9 @@ For detail descriptions and examples of the cmdlets, type
7272
You can also find the standalone installers for all the versions at [Downloads](https://github.com/Azure/azure-powershell/releases)
7373

7474
### PowerShell Gallery
75-
1. Install [Windows Management Framework 5 ot PowerShellGet cmdlets](https://www.powershellgallery.com/GettingStarted?section=Get%20Started)
75+
1. Install [Windows Management Framework 5 with PowerShellGet cmdlets](https://www.powershellgallery.com/GettingStarted?section=Get%20Started)
7676
2. In an elevated PowerShell session, run ```Install-Module AzureRM```
77-
3. run ```Install-AzureRm```
77+
3. Run ```Install-AzureRm```
7878
4. Top install RDFE cmdlets, run ```Install-Module Azure```
7979

8080
### Source Code

src/ResourceManager/AzureBatch/Commands.Batch.Test/Accounts/GetBatchAccountCommandTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public void ListBatchAccountsTest()
5555
BatchAccountContext expected01 = BatchAccountContext.ConvertAccountResourceToNewAccountContext(accountResource01);
5656
BatchAccountContext expected02 = BatchAccountContext.ConvertAccountResourceToNewAccountContext(accountResource02);
5757

58-
batchClientMock.Setup(b => b.ListAccounts(resourceGroup, null)).Returns(new List<BatchAccountContext>() { expected01, expected02 });
58+
batchClientMock.Setup(b => b.ListAccounts(null, resourceGroup)).Returns(new List<BatchAccountContext>() { expected01, expected02 });
5959

6060
cmdlet.AccountName = null;
6161
cmdlet.ResourceGroupName = resourceGroup;

src/ResourceManager/AzureBatch/Commands.Batch.Test/Accounts/NewBatchAccountCommandTests.cs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void NewBatchAccountTest()
4949
AccountResource accountResource = BatchTestHelpers.CreateAccountResource(accountName, resourceGroup);
5050
BatchAccountContext expected = BatchAccountContext.ConvertAccountResourceToNewAccountContext(accountResource);
5151

52-
batchClientMock.Setup(b => b.CreateAccount(resourceGroup, accountName, location, null)).Returns(expected);
52+
batchClientMock.Setup(b => b.CreateAccount(resourceGroup, accountName, location, null, null)).Returns(expected);
5353

5454
cmdlet.AccountName = accountName;
5555
cmdlet.ResourceGroupName = resourceGroup;
@@ -59,5 +59,29 @@ public void NewBatchAccountTest()
5959

6060
commandRuntimeMock.Verify(r => r.WriteObject(expected), Times.Once());
6161
}
62+
63+
[Fact]
64+
[Trait(Category.AcceptanceType, Category.CheckIn)]
65+
public void NewBatchWithAutoStorageAccountTest()
66+
{
67+
string accountName = "account01";
68+
string resourceGroup = "resourceGroup";
69+
string location = "location";
70+
string storageId = "storageId";
71+
72+
AccountResource accountResource = BatchTestHelpers.CreateAccountResource(accountName, resourceGroup);
73+
BatchAccountContext expected = BatchAccountContext.ConvertAccountResourceToNewAccountContext(accountResource);
74+
75+
batchClientMock.Setup(b => b.CreateAccount(resourceGroup, accountName, location, null, storageId)).Returns(expected);
76+
77+
cmdlet.AccountName = accountName;
78+
cmdlet.ResourceGroupName = resourceGroup;
79+
cmdlet.Location = location;
80+
cmdlet.AutoStorageAccountId = storageId;
81+
82+
cmdlet.ExecuteCmdlet();
83+
84+
commandRuntimeMock.Verify(r => r.WriteObject(expected), Times.Once());
85+
}
6286
}
6387
}

src/ResourceManager/AzureBatch/Commands.Batch.Test/Accounts/RemoveBatchAccountCommandTests.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ public void RemoveBatchAccountTest()
4545
string accountName = "account01";
4646
string resourceGroup = "resourceGroup";
4747

48-
AzureOperationResponse deleteResponse = new AzureOperationResponse();
49-
batchClientMock.Setup(b => b.DeleteAccount(resourceGroup, accountName)).Returns(deleteResponse);
50-
5148
cmdlet.AccountName = accountName;
5249
cmdlet.ResourceGroupName = resourceGroup;
5350

src/ResourceManager/AzureBatch/Commands.Batch.Test/Accounts/SetBatchAccountCommandTests.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ public void UpdateAccountTest()
4646
{
4747
string accountName = "account01";
4848
string resourceGroup = "resourceGroup";
49+
string storageId = "storageId";
50+
4951
Hashtable[] tags = new[]
5052
{
5153
new Hashtable
@@ -54,19 +56,19 @@ public void UpdateAccountTest()
5456
{"Value", "tagValue"}
5557
}
5658
};
59+
5760
AccountResource accountResource = BatchTestHelpers.CreateAccountResource(accountName, resourceGroup, tags);
5861
BatchAccountContext expected = BatchAccountContext.ConvertAccountResourceToNewAccountContext(accountResource);
59-
60-
batchClientMock.Setup(b => b.UpdateAccount(resourceGroup, accountName, tags)).Returns(expected);
62+
batchClientMock.Setup(b => b.UpdateAccount(resourceGroup, accountName, tags, storageId)).Returns(expected);
6163

6264
cmdlet.AccountName = accountName;
6365
cmdlet.ResourceGroupName = resourceGroup;
6466
cmdlet.Tag = tags;
67+
cmdlet.AutoStorageAccountId = storageId;
6568

6669
cmdlet.ExecuteCmdlet();
6770

6871
commandRuntimeMock.Verify(r => r.WriteObject(expected), Times.Once());
6972
}
70-
7173
}
7274
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
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 System;
16+
17+
using Microsoft.Azure.Commands.Batch.Models;
18+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
19+
using Moq;
20+
using System.Collections.Generic;
21+
using System.Management.Automation;
22+
using Xunit;
23+
using BatchClient = Microsoft.Azure.Commands.Batch.Models.BatchClient;
24+
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
25+
26+
namespace Microsoft.Azure.Commands.Batch.Test.Accounts
27+
{
28+
public class GetBatchApplicationCommandTests : RMTestBase
29+
{
30+
private GetBatchApplicationCommand cmdlet;
31+
private Mock<BatchClient> batchClientMock;
32+
private Mock<ICommandRuntime> commandRuntimeMock;
33+
34+
public GetBatchApplicationCommandTests()
35+
{
36+
batchClientMock = new Mock<BatchClient>();
37+
commandRuntimeMock = new Mock<ICommandRuntime>();
38+
cmdlet = new GetBatchApplicationCommand()
39+
{
40+
CommandRuntime = commandRuntimeMock.Object,
41+
BatchClient = batchClientMock.Object
42+
};
43+
}
44+
45+
[Fact]
46+
[Trait(Category.AcceptanceType, Category.CheckIn)]
47+
public void ListBatchApplicationsTest()
48+
{
49+
List<BatchAccountContext> pipelineOutput = new List<BatchAccountContext>();
50+
51+
string accountName01 = "account01";
52+
string resourceGroup = "resourceGroup";
53+
54+
PSApplication expected01 = new PSApplication();
55+
PSApplication expected02 = new PSApplication();
56+
57+
batchClientMock.Setup(b => b.ListApplications(resourceGroup, accountName01)).Returns(new List<PSApplication>() { expected01, expected02 });
58+
59+
cmdlet.AccountName = accountName01;
60+
cmdlet.ResourceGroupName = resourceGroup;
61+
62+
cmdlet.ExecuteCmdlet();
63+
64+
commandRuntimeMock.Verify(r => r.WriteObject(expected01), Times.Once());
65+
commandRuntimeMock.Verify(r => r.WriteObject(expected02), Times.Once());
66+
}
67+
68+
[Fact]
69+
[Trait(Category.AcceptanceType, Category.CheckIn)]
70+
public void GetBatchApplicationTest()
71+
{
72+
string accountName = "account01";
73+
string resourceGroup = "resourceGroup";
74+
string applicationId = "applicationId";
75+
76+
PSApplication expected = new PSApplication();
77+
batchClientMock.Setup(b => b.GetApplication(resourceGroup, accountName, applicationId)).Returns(expected);
78+
79+
cmdlet.AccountName = accountName;
80+
cmdlet.ResourceGroupName = resourceGroup;
81+
cmdlet.ApplicationId = applicationId;
82+
83+
cmdlet.ExecuteCmdlet();
84+
85+
commandRuntimeMock.Verify(r => r.WriteObject(expected), Times.Once());
86+
}
87+
}
88+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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 System.Management.Automation;
16+
using Microsoft.Azure.Commands.Batch.Models;
17+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
18+
using Moq;
19+
using Xunit;
20+
21+
namespace Microsoft.Azure.Commands.Batch.Test.Applications
22+
{
23+
public class GetBatchApplicationPackageCommandTests
24+
{
25+
private GetBatchApplicationPackageCommand cmdlet;
26+
private Mock<BatchClient> batchClientMock;
27+
private Mock<ICommandRuntime> commandRuntimeMock;
28+
29+
public GetBatchApplicationPackageCommandTests()
30+
{
31+
batchClientMock = new Mock<BatchClient>();
32+
commandRuntimeMock = new Mock<ICommandRuntime>();
33+
cmdlet = new GetBatchApplicationPackageCommand()
34+
{
35+
CommandRuntime = commandRuntimeMock.Object,
36+
BatchClient = batchClientMock.Object
37+
};
38+
}
39+
40+
[Fact]
41+
[Trait(Category.AcceptanceType, Category.CheckIn)]
42+
public void GetBatchApplicationPackageTest()
43+
{
44+
string accountName = "account01";
45+
string resourceGroup = "resourceGroup";
46+
string applicationId = "test";
47+
string applicationVersion = "foo";
48+
49+
PSApplicationPackage expected = new PSApplicationPackage() { Id = applicationId, Version = applicationVersion };
50+
batchClientMock.Setup(b => b.GetApplicationPackage(resourceGroup, accountName, applicationId, applicationVersion)).Returns(expected);
51+
52+
cmdlet.AccountName = accountName;
53+
cmdlet.ResourceGroupName = resourceGroup;
54+
cmdlet.ApplicationId = applicationId;
55+
cmdlet.ApplicationVersion = applicationVersion;
56+
57+
cmdlet.ExecuteCmdlet();
58+
59+
commandRuntimeMock.Verify(r => r.WriteObject(expected), Times.Once());
60+
}
61+
}
62+
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
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 System.Management.Automation;
16+
using Microsoft.Azure.Commands.Batch.Models;
17+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
18+
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
19+
using Moq;
20+
using Xunit;
21+
22+
namespace Microsoft.Azure.Commands.Batch.Test.Applications
23+
{
24+
public class NewBatchApplicationCommandTests : RMTestBase
25+
{
26+
private NewBatchApplicationCommand cmdlet;
27+
private Mock<BatchClient> batchClientMock;
28+
private Mock<ICommandRuntime> commandRuntimeMock;
29+
30+
public NewBatchApplicationCommandTests()
31+
{
32+
batchClientMock = new Mock<BatchClient>();
33+
commandRuntimeMock = new Mock<ICommandRuntime>();
34+
cmdlet = new NewBatchApplicationCommand()
35+
{
36+
CommandRuntime = commandRuntimeMock.Object,
37+
BatchClient = batchClientMock.Object
38+
};
39+
}
40+
41+
[Fact]
42+
[Trait(Category.AcceptanceType, Category.CheckIn)]
43+
public void AddBatchApplicationTest()
44+
{
45+
string accountName = "account01";
46+
string resourceGroup = "resourceGroup";
47+
string applicationId = "applicationId";
48+
string displayName = "displayName";
49+
50+
PSApplication expected = new PSApplication();
51+
52+
batchClientMock.Setup(b => b.AddApplication(resourceGroup, accountName, applicationId, true, displayName)).Returns(expected);
53+
54+
cmdlet.ResourceGroupName = resourceGroup;
55+
cmdlet.AccountName = accountName;
56+
cmdlet.ApplicationId = applicationId;
57+
cmdlet.AllowUpdates = true;
58+
cmdlet.DisplayName = displayName;
59+
60+
cmdlet.ExecuteCmdlet();
61+
62+
commandRuntimeMock.Verify(r => r.WriteObject(expected), Times.Once());
63+
}
64+
65+
[Fact]
66+
[Trait(Category.AcceptanceType, Category.CheckIn)]
67+
public void AddBatchApplicationTestWithoutAllowUpdates()
68+
{
69+
string accountName = "account01";
70+
string resourceGroup = "resourceGroup";
71+
string applicationId = "applicationId";
72+
string displayName = "displayName";
73+
74+
PSApplication expected = new PSApplication();
75+
76+
batchClientMock.Setup(b => b.AddApplication(resourceGroup, accountName, applicationId, null, displayName)).Returns(expected);
77+
78+
cmdlet.ResourceGroupName = resourceGroup;
79+
cmdlet.AccountName = accountName;
80+
cmdlet.ApplicationId = applicationId;
81+
82+
cmdlet.DisplayName = displayName;
83+
84+
cmdlet.ExecuteCmdlet();
85+
86+
commandRuntimeMock.Verify(r => r.WriteObject(expected), Times.Once());
87+
}
88+
}
89+
}

0 commit comments

Comments
 (0)