Пример #1
0
        public RemoveAzureRmAutoscaleSettingTests(Xunit.Abstractions.ITestOutputHelper output)
        {
            ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
            insightsAutoscaleOperationsMock = new Mock <IAutoscaleSettingsOperations>();
            insightsManagementClientMock    = new Mock <MonitorManagementClient>();
            commandRuntimeMock = new Mock <ICommandRuntime>();
            cmdlet             = new RemoveAzureRmAutoscaleSettingCommand()
            {
                CommandRuntime          = commandRuntimeMock.Object,
                MonitorManagementClient = insightsManagementClientMock.Object
            };

            insightsAutoscaleOperationsMock.Setup(f => f.DeleteWithHttpMessagesAsync(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <Dictionary <string, List <string> > >(), It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult <Microsoft.Rest.Azure.AzureOperationResponse>(new Microsoft.Rest.Azure.AzureOperationResponse()))
            .Callback((string resourceGrp, string settingNm, Dictionary <string, List <string> > headers, CancellationToken t) =>
            {
                resourceGroup = resourceGrp;
                settingName   = settingNm;
            });

            insightsManagementClientMock.SetupGet(f => f.AutoscaleSettings).Returns(this.insightsAutoscaleOperationsMock.Object);

            // Setup Confirmation
            commandRuntimeMock.Setup(f => f.ShouldProcess(It.IsAny <string>())).Returns(true);
            commandRuntimeMock.Setup(f => f.ShouldProcess(It.IsAny <string>(), It.IsAny <string>())).Returns(true);
            commandRuntimeMock.Setup(f => f.ShouldProcess(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())).Returns(true);
            commandRuntimeMock.Setup(f => f.ShouldContinue(It.IsAny <string>(), It.IsAny <string>())).Returns(true);
        }
        public RemoveAzureRmAutoscaleSettingTests(Xunit.Abstractions.ITestOutputHelper output)
        {
            ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
            insightsAutoscaleOperationsMock = new Mock <IAutoscaleOperations>();
            insightsManagementClientMock    = new Mock <InsightsManagementClient>();
            commandRuntimeMock = new Mock <ICommandRuntime>();
            cmdlet             = new RemoveAzureRmAutoscaleSettingCommand()
            {
                CommandRuntime           = commandRuntimeMock.Object,
                InsightsManagementClient = insightsManagementClientMock.Object
            };

            response = new AzureOperationResponse()
            {
                RequestId  = Guid.NewGuid().ToString(),
                StatusCode = HttpStatusCode.OK,
            };

            insightsAutoscaleOperationsMock.Setup(f => f.DeleteSettingAsync(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult <AzureOperationResponse>(response))
            .Callback((string resourceGrp, string settingNm, CancellationToken t) =>
            {
                resourceGroup = resourceGrp;
                settingName   = settingNm;
            });

            insightsManagementClientMock.SetupGet(f => f.AutoscaleOperations).Returns(this.insightsAutoscaleOperationsMock.Object);
        }
Пример #3
0
        public RemoveAzureRmAutoscaleSettingTests()
        {
            insightsAutoscaleOperationsMock = new Mock <IAutoscaleOperations>();
            insightsManagementClientMock    = new Mock <InsightsManagementClient>();
            commandRuntimeMock = new Mock <ICommandRuntime>();
            cmdlet             = new RemoveAzureRmAutoscaleSettingCommand()
            {
                CommandRuntime           = commandRuntimeMock.Object,
                InsightsManagementClient = insightsManagementClientMock.Object
            };

            response = new AzureOperationResponse()
            {
                RequestId  = Guid.NewGuid().ToString(),
                StatusCode = HttpStatusCode.OK,
            };

            insightsAutoscaleOperationsMock.Setup(f => f.DeleteSettingAsync(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult <AzureOperationResponse>(response))
            .Callback((string resourceGrp, string settingNm, CancellationToken t) =>
            {
                resourceGroup = resourceGrp;
                settingName   = settingNm;
            });

            insightsManagementClientMock.SetupGet(f => f.AutoscaleOperations).Returns(this.insightsAutoscaleOperationsMock.Object);
        }