-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from Azure/dev
.
- Loading branch information
Showing
118 changed files
with
8,376 additions
and
4,069 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
...anager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationCertificateTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
// ---------------------------------------------------------------------------------- | ||
// | ||
// Copyright Microsoft Corporation | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ---------------------------------------------------------------------------------- | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using Microsoft.Azure.Commands.Automation.Cmdlet; | ||
using Microsoft.Azure.Commands.Automation.Common; | ||
using Microsoft.Azure.Commands.Automation.Model; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; | ||
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; | ||
using Microsoft.WindowsAzure.Commands.Utilities.Common; | ||
using Moq; | ||
|
||
namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests | ||
{ | ||
[TestClass] | ||
public class GetAzureAutomationCertificateTest : TestBase | ||
{ | ||
private Mock<IAutomationClient> mockAutomationClient; | ||
|
||
private MockCommandRuntime mockCommandRuntime; | ||
|
||
private GetAzureAutomationCertificate cmdlet; | ||
|
||
[TestInitialize] | ||
public void SetupTest() | ||
{ | ||
this.mockAutomationClient = new Mock<IAutomationClient>(); | ||
this.mockCommandRuntime = new MockCommandRuntime(); | ||
this.cmdlet = new GetAzureAutomationCertificate | ||
{ | ||
AutomationClient = this.mockAutomationClient.Object, | ||
CommandRuntime = this.mockCommandRuntime | ||
}; | ||
} | ||
|
||
[TestMethod] | ||
public void GetAzureAutomationCertificateByNameSuccessfull() | ||
{ | ||
// Setup | ||
string resourceGroupName = "resourceGroup"; | ||
string accountName = "automation"; | ||
string certificateName = "certificate"; | ||
|
||
this.mockAutomationClient.Setup(f => f.GetCertificate(resourceGroupName, accountName, certificateName)); | ||
|
||
// Test | ||
this.cmdlet.ResourceGroupName = resourceGroupName; | ||
this.cmdlet.AutomationAccountName = accountName; | ||
this.cmdlet.Name = certificateName; | ||
this.cmdlet.SetParameterSet("ByCertificateName"); | ||
this.cmdlet.ExecuteCmdlet(); | ||
|
||
// Assert | ||
this.mockAutomationClient.Verify(f => f.GetCertificate(resourceGroupName, accountName, certificateName), Times.Once()); | ||
} | ||
|
||
[TestMethod] | ||
public void GetAzureAutomationCertificateByAllSuccessfull() | ||
{ | ||
// Setup | ||
string resourceGroupName = "resourceGroup"; | ||
string accountName = "automation"; | ||
string nextLink = string.Empty; | ||
|
||
this.mockAutomationClient.Setup(f => f.ListCertificates(resourceGroupName, accountName, ref nextLink)).Returns((string a, string b, string c) => new List<CertificateInfo>()); | ||
|
||
// Test | ||
this.cmdlet.ResourceGroupName = resourceGroupName; | ||
this.cmdlet.AutomationAccountName = accountName; | ||
this.cmdlet.ExecuteCmdlet(); | ||
|
||
// Assert | ||
this.mockAutomationClient.Verify(f => f.ListCertificates(resourceGroupName, accountName, ref nextLink), Times.Once()); | ||
} | ||
} | ||
} |
110 changes: 110 additions & 0 deletions
110
...Manager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationConnectionTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
// ---------------------------------------------------------------------------------- | ||
// | ||
// Copyright Microsoft Corporation | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ---------------------------------------------------------------------------------- | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using Microsoft.Azure.Commands.Automation.Cmdlet; | ||
using Microsoft.Azure.Commands.Automation.Common; | ||
using Microsoft.Azure.Commands.Automation.Model; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; | ||
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; | ||
using Microsoft.WindowsAzure.Commands.Utilities.Common; | ||
using Moq; | ||
|
||
namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests | ||
{ | ||
[TestClass] | ||
public class GetAzureAutomationConnectionTest : TestBase | ||
{ | ||
private Mock<IAutomationClient> mockAutomationClient; | ||
|
||
private MockCommandRuntime mockCommandRuntime; | ||
|
||
private GetAzureAutomationConnection cmdlet; | ||
|
||
[TestInitialize] | ||
public void SetupTest() | ||
{ | ||
this.mockAutomationClient = new Mock<IAutomationClient>(); | ||
this.mockCommandRuntime = new MockCommandRuntime(); | ||
this.cmdlet = new GetAzureAutomationConnection | ||
{ | ||
AutomationClient = this.mockAutomationClient.Object, | ||
CommandRuntime = this.mockCommandRuntime | ||
}; | ||
} | ||
|
||
[TestMethod] | ||
public void GetAzureAutomationConnectionByNameSuccessfull() | ||
{ | ||
// Setup | ||
string resourceGroupName = "resourceGroup"; | ||
string accountName = "automation"; | ||
string connectionName = "connection"; | ||
|
||
this.mockAutomationClient.Setup(f => f.GetConnection(resourceGroupName, accountName, connectionName)); | ||
|
||
// Test | ||
this.cmdlet.ResourceGroupName = resourceGroupName; | ||
this.cmdlet.AutomationAccountName = accountName; | ||
this.cmdlet.Name = connectionName; | ||
this.cmdlet.SetParameterSet("ByConnectionName"); | ||
this.cmdlet.ExecuteCmdlet(); | ||
|
||
// Assert | ||
this.mockAutomationClient.Verify(f => f.GetConnection(resourceGroupName, accountName, connectionName), Times.Once()); | ||
} | ||
|
||
[TestMethod] | ||
public void GetAzureAutomationConnectionByAllSuccessfull() | ||
{ | ||
// Setup | ||
string resourceGroupName = "resourceGroup"; | ||
string accountName = "automation"; | ||
string nextLink = string.Empty; | ||
|
||
this.mockAutomationClient.Setup(f => f.ListConnections(resourceGroupName, accountName, ref nextLink)).Returns((string a, string b, string c) => new List<Connection>()); | ||
|
||
// Test | ||
this.cmdlet.ResourceGroupName = resourceGroupName; | ||
this.cmdlet.AutomationAccountName = accountName; | ||
this.cmdlet.ExecuteCmdlet(); | ||
|
||
// Assert | ||
this.mockAutomationClient.Verify(f => f.ListConnections(resourceGroupName, accountName, ref nextLink), Times.Once()); | ||
} | ||
|
||
[TestMethod] | ||
public void GetAzureAutomationConnectionByTypeSuccessfull() | ||
{ | ||
// Setup | ||
string resourceGroupName = "resourceGroup"; | ||
string accountName = "automation"; | ||
string connectionTypeName = "connectionType"; | ||
|
||
this.mockAutomationClient.Setup(f => f.ListConnectionsByType(resourceGroupName, accountName, connectionTypeName)).Returns((string a, string b, string c) => new List<Connection>()); | ||
|
||
// Test | ||
this.cmdlet.ResourceGroupName = resourceGroupName; | ||
this.cmdlet.AutomationAccountName = accountName; | ||
this.cmdlet.ConnectionTypeName = connectionTypeName; | ||
this.cmdlet.SetParameterSet("ByConnectionTypeName"); | ||
this.cmdlet.ExecuteCmdlet(); | ||
|
||
// Assert | ||
this.mockAutomationClient.Verify(f => f.ListConnectionsByType(resourceGroupName, accountName, connectionTypeName), Times.Once()); | ||
} | ||
} | ||
} |
87 changes: 87 additions & 0 deletions
87
...Manager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationCredentialTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// ---------------------------------------------------------------------------------- | ||
// | ||
// Copyright Microsoft Corporation | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ---------------------------------------------------------------------------------- | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using Microsoft.Azure.Commands.Automation.Cmdlet; | ||
using Microsoft.Azure.Commands.Automation.Common; | ||
using Microsoft.Azure.Commands.Automation.Model; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; | ||
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; | ||
using Moq; | ||
|
||
namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests | ||
{ | ||
[TestClass] | ||
public class GetAzureAutomationCredentialTest : TestBase | ||
{ | ||
private Mock<IAutomationClient> mockAutomationClient; | ||
|
||
private MockCommandRuntime mockCommandRuntime; | ||
|
||
private GetAzureAutomationCredential cmdlet; | ||
|
||
[TestInitialize] | ||
public void SetupTest() | ||
{ | ||
this.mockAutomationClient = new Mock<IAutomationClient>(); | ||
this.mockCommandRuntime = new MockCommandRuntime(); | ||
this.cmdlet = new GetAzureAutomationCredential | ||
{ | ||
AutomationClient = this.mockAutomationClient.Object, | ||
CommandRuntime = this.mockCommandRuntime | ||
}; | ||
} | ||
|
||
[TestMethod] | ||
public void GetAzureAutomationCredentialByNameSuccessfull() | ||
{ | ||
// Setup | ||
string resourceGroupName = "resourceGroup"; | ||
string accountName = "automation"; | ||
string credentialName = "credential"; | ||
|
||
this.mockAutomationClient.Setup(f => f.GetCredential(resourceGroupName, accountName, credentialName)); | ||
|
||
// Test | ||
this.cmdlet.ResourceGroupName = resourceGroupName; | ||
this.cmdlet.AutomationAccountName = accountName; | ||
this.cmdlet.Name = credentialName; | ||
this.cmdlet.ExecuteCmdlet(); | ||
|
||
// Assert | ||
this.mockAutomationClient.Verify(f => f.GetCredential(resourceGroupName, accountName, credentialName), Times.Once()); | ||
} | ||
|
||
[TestMethod] | ||
public void GetAzureAutomationCredentialByAllSuccessfull() | ||
{ | ||
// Setup | ||
string resourceGroupName = "resourceGroup"; | ||
string accountName = "automation"; | ||
string nextLink = string.Empty; | ||
|
||
this.mockAutomationClient.Setup(f => f.ListCredentials(resourceGroupName, accountName, ref nextLink)).Returns((string a, string b, string c) => new List<CredentialInfo>()); | ||
|
||
// Test | ||
this.cmdlet.ResourceGroupName = resourceGroupName; | ||
this.cmdlet.AutomationAccountName = accountName; | ||
this.cmdlet.ExecuteCmdlet(); | ||
|
||
// Assert | ||
this.mockAutomationClient.Verify(f => f.ListCredentials(resourceGroupName, accountName, ref nextLink), Times.Once()); | ||
} | ||
} | ||
} |
Oops, something went wrong.