12
12
// limitations under the License.
13
13
// ----------------------------------------------------------------------------------
14
14
15
- // using Microsoft.Azure.Commands.Common.Test.Mocks ;
15
+ using System . Management . Automation ;
16
16
using Microsoft . Azure . Commands . ResourceManager . Cmdlets . Implementation ;
17
17
using Microsoft . Azure . Commands . ResourceManager . Cmdlets . SdkClient ;
18
- using Microsoft . Azure . Commands . ScenarioTest ;
19
18
using Microsoft . Azure . ServiceManagemenet . Common . Models ;
20
- using Microsoft . WindowsAzure . Commands . Common . Test . Mocks ;
21
- using Microsoft . WindowsAzure . Commands . ScenarioTest ;
22
19
using Moq ;
23
- using System . Management . Automation ;
24
- using System . Management . Automation ;
25
20
using Xunit ;
26
21
using Xunit . Abstractions ;
27
22
23
+
28
24
namespace Microsoft . Azure . Commands . Resources . Test . Resources
29
25
{
30
26
public class StopAzureResourceGroupDeploymentCommandTests
@@ -34,37 +30,36 @@ public class StopAzureResourceGroupDeploymentCommandTests
34
30
private Mock < ResourceManagerSdkClient > resourcesClientMock ;
35
31
36
32
private Mock < ICommandRuntime > commandRuntimeMock ;
37
- private MockCommandRuntime mockRuntime ;
38
33
39
34
private string resourceGroupName = "myResourceGroup" ;
40
35
36
+ private string deploymentName = "myDeployment" ;
37
+
41
38
public StopAzureResourceGroupDeploymentCommandTests ( ITestOutputHelper output )
42
39
{
43
40
resourcesClientMock = new Mock < ResourceManagerSdkClient > ( ) ;
44
41
XunitTracingInterceptor . AddToContext ( new XunitTracingInterceptor ( output ) ) ;
45
42
commandRuntimeMock = new Mock < ICommandRuntime > ( ) ;
46
43
cmdlet = new StopAzureResourceGroupDeploymentCmdlet ( )
47
44
{
48
- // CommandRuntime = commandRuntimeMock.Object,
45
+ CommandRuntime = commandRuntimeMock . Object ,
49
46
ResourceManagerSdkClient = resourcesClientMock . Object
50
47
} ;
51
- PSCmdletExtensions . SetCommandRuntimeMock ( cmdlet , commandRuntimeMock . Object ) ;
52
- mockRuntime = new MockCommandRuntime ( ) ;
53
- commandRuntimeMock . Setup ( f => f . Host ) . Returns ( mockRuntime . Host ) ;
54
-
55
48
}
56
49
57
50
[ Fact ]
58
51
public void StopsActiveDeployment ( )
59
52
{
60
53
commandRuntimeMock . Setup ( f => f . ShouldProcess ( It . IsAny < string > ( ) , It . IsAny < string > ( ) ) ) . Returns ( true ) ;
54
+ resourcesClientMock . Setup ( f => f . CancelDeployment ( resourceGroupName , deploymentName ) ) ;
61
55
62
56
cmdlet . ResourceGroupName = resourceGroupName ;
57
+ cmdlet . Name = deploymentName ;
63
58
cmdlet . Force = true ;
64
59
65
60
cmdlet . ExecuteCmdlet ( ) ;
66
61
67
- commandRuntimeMock . Verify ( f => f . WriteObject ( true ) , Times . Once ( ) ) ;
62
+ resourcesClientMock . Verify ( f => f . CancelDeployment ( resourceGroupName , deploymentName ) , Times . Once ( ) ) ;
68
63
}
69
64
}
70
65
}
0 commit comments