diff --git a/src/ResourceManager/Resources/Commands.Resources.Test/ResourceGroupDeployments/RemoveAzureResourceGroupDeploymentCommandTests.cs b/src/ResourceManager/Resources/Commands.Resources.Test/ResourceGroupDeployments/RemoveAzureResourceGroupDeploymentCommandTests.cs index db18b466063a..a3dce47b3ee9 100644 --- a/src/ResourceManager/Resources/Commands.Resources.Test/ResourceGroupDeployments/RemoveAzureResourceGroupDeploymentCommandTests.cs +++ b/src/ResourceManager/Resources/Commands.Resources.Test/ResourceGroupDeployments/RemoveAzureResourceGroupDeploymentCommandTests.cs @@ -12,12 +12,11 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using System.Management.Automation; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkClient; using Microsoft.Azure.ServiceManagemenet.Common.Models; using Moq; -using System.Management.Automation; -using System.Management.Automation; using Xunit; using Xunit.Abstractions; @@ -51,6 +50,7 @@ public RemoveAzureResourceGroupDeploymentCommandTests(ITestOutputHelper output) public void RemoveDeployment() { commandRuntimeMock.Setup(f => f.ShouldProcess(It.IsAny(), It.IsAny())).Returns(true); + resourcesClientMock.Setup(f => f.DeleteDeployment(resourceGroupName, deploymentName)); cmdlet.ResourceGroupName = resourceGroupName; cmdlet.Name = deploymentName; @@ -58,7 +58,7 @@ public void RemoveDeployment() cmdlet.ExecuteCmdlet(); - commandRuntimeMock.Verify(f => f.WriteObject(true), Times.Once()); + resourcesClientMock.Verify(f => f.DeleteDeployment(resourceGroupName, deploymentName), Times.Once()); } } } diff --git a/src/ResourceManager/Resources/Commands.Resources.Test/ResourceGroupDeployments/StopAzureResourceGroupDeploymentCommandTests.cs b/src/ResourceManager/Resources/Commands.Resources.Test/ResourceGroupDeployments/StopAzureResourceGroupDeploymentCommandTests.cs index 3b310ab350c8..e420b2b09df1 100644 --- a/src/ResourceManager/Resources/Commands.Resources.Test/ResourceGroupDeployments/StopAzureResourceGroupDeploymentCommandTests.cs +++ b/src/ResourceManager/Resources/Commands.Resources.Test/ResourceGroupDeployments/StopAzureResourceGroupDeploymentCommandTests.cs @@ -12,19 +12,15 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -//using Microsoft.Azure.Commands.Common.Test.Mocks; +using System.Management.Automation; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation; using Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkClient; -using Microsoft.Azure.Commands.ScenarioTest; using Microsoft.Azure.ServiceManagemenet.Common.Models; -using Microsoft.WindowsAzure.Commands.Common.Test.Mocks; -using Microsoft.WindowsAzure.Commands.ScenarioTest; using Moq; -using System.Management.Automation; -using System.Management.Automation; using Xunit; using Xunit.Abstractions; + namespace Microsoft.Azure.Commands.Resources.Test.Resources { public class StopAzureResourceGroupDeploymentCommandTests @@ -34,10 +30,11 @@ public class StopAzureResourceGroupDeploymentCommandTests private Mock resourcesClientMock; private Mock commandRuntimeMock; - private MockCommandRuntime mockRuntime; private string resourceGroupName = "myResourceGroup"; + private string deploymentName = "myDeployment"; + public StopAzureResourceGroupDeploymentCommandTests(ITestOutputHelper output) { resourcesClientMock = new Mock(); @@ -45,26 +42,24 @@ public StopAzureResourceGroupDeploymentCommandTests(ITestOutputHelper output) commandRuntimeMock = new Mock(); cmdlet = new StopAzureResourceGroupDeploymentCmdlet() { - //CommandRuntime = commandRuntimeMock.Object, + CommandRuntime = commandRuntimeMock.Object, ResourceManagerSdkClient = resourcesClientMock.Object }; - PSCmdletExtensions.SetCommandRuntimeMock(cmdlet, commandRuntimeMock.Object); - mockRuntime = new MockCommandRuntime(); - commandRuntimeMock.Setup(f => f.Host).Returns(mockRuntime.Host); - } [Fact] public void StopsActiveDeployment() { commandRuntimeMock.Setup(f => f.ShouldProcess(It.IsAny(), It.IsAny())).Returns(true); + resourcesClientMock.Setup(f => f.CancelDeployment(resourceGroupName, deploymentName)); cmdlet.ResourceGroupName = resourceGroupName; + cmdlet.Name = deploymentName; cmdlet.Force = true; cmdlet.ExecuteCmdlet(); - commandRuntimeMock.Verify(f => f.WriteObject(true), Times.Once()); + resourcesClientMock.Verify(f => f.CancelDeployment(resourceGroupName, deploymentName), Times.Once()); } } }