当前位置: 首页>>代码示例>>C#>>正文


C# AzureOperationResponse类代码示例

本文整理汇总了C#中AzureOperationResponse的典型用法代码示例。如果您正苦于以下问题:C# AzureOperationResponse类的具体用法?C# AzureOperationResponse怎么用?C# AzureOperationResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AzureOperationResponse类属于命名空间,在下文中一共展示了AzureOperationResponse类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddAzureRmWebtestAlertRuleTests

        public AddAzureRmWebtestAlertRuleTests()
        {
            insightsAlertRuleOperationsMock = new Mock<IAlertOperations>();
            insightsManagementClientMock = new Mock<InsightsManagementClient>();
            commandRuntimeMock = new Mock<ICommandRuntime>();
            cmdlet = new AddAzureRmWebtestAlertRuleCommand()
            {
                CommandRuntime = commandRuntimeMock.Object,
                InsightsManagementClient = insightsManagementClientMock.Object
            };

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

            insightsAlertRuleOperationsMock.Setup(f => f.CreateOrUpdateRuleAsync(It.IsAny<string>(), It.IsAny<RuleCreateOrUpdateParameters>(), It.IsAny<CancellationToken>()))
                .Returns(Task.FromResult<AzureOperationResponse>(response))
                .Callback((string resourceGrp, RuleCreateOrUpdateParameters createOrUpdateParams, CancellationToken t) =>
                {
                    resourceGroup = resourceGrp;
                    createOrUpdatePrms = createOrUpdateParams;
                });

            insightsManagementClientMock.SetupGet(f => f.AlertOperations).Returns(this.insightsAlertRuleOperationsMock.Object);
        }
开发者ID:singhkays,项目名称:azure-powershell,代码行数:27,代码来源:AddAzureRmWebtestAlertRuleTests.cs

示例2: GetIntuneAndroidMAMPolicyGroupCmdlet_ReturnsValidItem_Test

        public void GetIntuneAndroidMAMPolicyGroupCmdlet_ReturnsValidItem_Test()
        {
            // Set up the expected App            
            string expectedAppResBody = "{\"value\":[{\"id\":\"/providers/Microsoft.Intune/locations/fef.bmsua01/androidPolicies/24bdd9a9-45e6-464c-a5be-82146fbe9646/groups/046e0be0-5828-47e2-8876-b6a2e33f0ccf\",\"name\":\"046e0be0-5828-47e2-8876-b6a2e33f0ccf\",\"type\":\"Microsoft.Intune/locations/androidPolicies/groups\",\"properties\":{\"friendlyName\":\"SG7\"}}]}";
            
            var expectedRespose = new AzureOperationResponse<IPage<GroupItem>>();
            var expectedResultPage = new Page<GroupItem>();

            expectedResultPage = JsonConvert.DeserializeObject<Page<GroupItem>>(expectedAppResBody, intuneClientMock.Object.DeserializationSettings);

            expectedRespose.Body = expectedResultPage;

            // Set up the mock methods
            intuneClientMock.Setup(f => f.Android.GetGroupsForMAMPolicyWithHttpMessagesAsync(
                    expectedLocation.HostName, 
                    It.IsAny<string>(), // policy
                    It.IsAny<Dictionary<string, List<string>>>(), // dict
                    It.IsAny<CancellationToken>())) // cancelationToken
                .Returns(Task.FromResult(expectedRespose));

            intuneClientMock.Setup(f => f.Android.GetGroupsForMAMPolicyNextWithHttpMessagesAsync(
                    It.IsAny<string>(),
                    It.IsAny<Dictionary<string, List<string>>>(), 
                    It.IsAny<CancellationToken>()))
                .Returns(Task.FromResult(expectedRespose));

            commandRuntimeMock.Setup(m => m.ShouldProcess(It.IsAny<string>(), It.IsAny<string>()))
                .Returns(() => true);

            // Set cmdline args and execute the cmdlet
            this.cmdlet.ExecuteCmdlet();

            // Verify the result
            commandRuntimeMock.Verify(f => f.WriteObject(expectedResultPage, true), Times.Once());
        }
开发者ID:docschmidt,项目名称:azure-powershell,代码行数:35,代码来源:GetIntuneAndroidMAMPolicyGroupCmdletTests.cs

示例3: RemoveAzureRmAutoscaleSettingTests

        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);
        }
开发者ID:brnleehng,项目名称:azure-powershell,代码行数:28,代码来源:RemoveAzureRmAutoscaleSettingTests.cs

示例4: RemoveAzureRmAutoscaleSettingTests

        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);
        }
开发者ID:singhkays,项目名称:azure-powershell,代码行数:27,代码来源:RemoveAzureRmAutoscaleSettingTests.cs

示例5: GetIntuneMAMUserDeviceWipe_ReturnsValidItem_Test

        public void GetIntuneMAMUserDeviceWipe_ReturnsValidItem_Test()
        {
            // Set up the expected Policy            
            string deviceWipeResponse = "{\r\n  \"name\": \"8693b393-a69c-4d12-a9c8-a1a415884fd2\",\r\n  \"type\": \"Microsoft.Intune/locations/users/devices\",\r\n  \"properties\": {\r\n    \"value\": \"/operationResults/8693b393-a69c-4d12-a9c8-a1a415884fd2?$filter=category eq '8693b393-a69c-4d12-a9c8-a1a415884fd2'\"\r\n  }\r\n}";

            AzureOperationResponse<WipeDeviceOperationResult> expectedRespose = new AzureOperationResponse<WipeDeviceOperationResult>();            
            var expectedResult = JsonConvert.DeserializeObject<WipeDeviceOperationResult>(deviceWipeResponse, intuneClientMock.Object.DeserializationSettings);

            expectedRespose.Body = expectedResult;
            WipeDeviceOperationResult wipeDeviceOpResult = new WipeDeviceOperationResult();
            // Set up the mock methods
            intuneClientMock.Setup(f => f.WipeMAMUserDeviceWithHttpMessagesAsync(
                    expectedLocation.HostName,
                    It.IsAny<string>(),
                    It.IsAny<string>(),
                    It.IsAny<Dictionary<string, List<string>>>(),
                    It.IsAny<CancellationToken>()))
                    .Returns(Task.FromResult(expectedRespose));

            commandRuntimeMock.Setup(m => m.ShouldProcess(It.IsAny<string>(), It.IsAny<string>()))
                .Returns(() => true);

            // Set cmdline args and execute the cmdlet
            this.cmdlet.Force = true;
            this.cmdlet.Name = "UserName1";
            this.cmdlet.DeviceName = "MyDevice1";            
            this.cmdlet.ExecuteCmdlet();

            // Verify the result
            commandRuntimeMock.Verify(f => f.WriteObject(expectedResult), Times.Once());
        }
开发者ID:Azure,项目名称:azure-powershell,代码行数:31,代码来源:InvokeIntuneMAMUserDeviceWipeCmdletTests.cs

示例6: GetIntuneMAMStatus_ReturnsValidItem_Test

        public void GetIntuneMAMStatus_ReturnsValidItem_Test()
        {
            // Set up the expected Policy            
            string mamStatus = "{\r\n  \"id\": \"/providers/Microsoft.Intune/locations/fef.bmsua01/statuses/default\",\r\n  \"name\": \"default\",\r\n  \"type\": \"Microsoft.Intune/locations/statuses\",\r\n  \"properties\": {\r\n    \"deployedPolicies\": 0,\r\n    \"status\": \"complete\",\r\n    \"flaggedUsers\": 0,\r\n    \"policyAppliedUsers\": 0,\r\n    \"enrolledUsers\": 0,\r\n    \"wipePendingApps\": 0,\r\n    \"wipeFailedApps\": 0,\r\n    \"wipeSucceededApps\": 0,\r\n    \"lastModifiedTime\": \"2015-11-24T21:32:05.4576414\"\r\n  }\r\n}";

            AzureOperationResponse<StatusesDefault> expectedRespose = new AzureOperationResponse<StatusesDefault>();
            StatusesDefault expectedResult = JsonConvert.DeserializeObject<StatusesDefault>(mamStatus, intuneClientMock.Object.DeserializationSettings);

            expectedRespose.Body = expectedResult;

            // Set up the mock methods
            intuneClientMock.Setup(f => f.GetMAMStatusesWithHttpMessagesAsync(
                    expectedLocation.HostName,
                    It.IsAny<Dictionary<string, List<string>>>(),
                    It.IsAny<CancellationToken>()))
                    .Returns(Task.FromResult(expectedRespose));

            commandRuntimeMock.Setup(m => m.ShouldProcess(It.IsAny<string>(), It.IsAny<string>()))
                .Returns(() => true);

            // Set cmdline args and execute the cmdlet
            this.cmdlet.ExecuteCmdlet();

            // Verify the result
            commandRuntimeMock.Verify(f => f.WriteObject(expectedResult), Times.Once());
        }
开发者ID:Azure,项目名称:azure-powershell,代码行数:26,代码来源:GetIntuneMAMStatusCmdletTests.cs

示例7: GetAzureRmLogProfileTests

        public GetAzureRmLogProfileTests(ITestOutputHelper output)
        {
            //XunitTracingInterceptor.AddToContext(new XunitTracingInterceptor(output));
            insightsLogProfileOperationsMock = new Mock<ILogProfilesOperations>();
            insightsClientMock = new Mock<InsightsManagementClient>();
            commandRuntimeMock = new Mock<ICommandRuntime>();
            cmdlet = new GetAzureRmLogProfileCommand()
            {
                CommandRuntime = commandRuntimeMock.Object,
                InsightsManagementClient = insightsClientMock.Object
            };

            response = Test.Utilities.InitializeLogProfileResponse();

            insightsLogProfileOperationsMock.Setup(f => f.GetWithHttpMessagesAsync(It.IsAny<string>(), It.IsAny<Dictionary<string, List<string>>>(), It.IsAny<CancellationToken>()))
                .Returns(Task.FromResult<AzureOperationResponse<LogProfileResource>>(response))
                .Callback((string pfn, Dictionary<string, List<string>> headers, CancellationToken t) =>
                {
                    logProfileName = pfn;
                });

            responseList = new AzureOperationResponse<IEnumerable<LogProfileResource>>()
            {
                Body = new List<LogProfileResource>() {response.Body}
            };

            insightsLogProfileOperationsMock.Setup(f => f.ListWithHttpMessagesAsync(It.IsAny<Dictionary<string, List<string>>>(), It.IsAny<CancellationToken>()))
                .Returns(Task.FromResult<AzureOperationResponse<IEnumerable<LogProfileResource>>>(responseList))
                .Callback((Dictionary<string, List<string>> headers, CancellationToken t) => {});

            insightsClientMock.SetupGet(f => f.LogProfiles).Returns(this.insightsLogProfileOperationsMock.Object);
        }
开发者ID:Azure,项目名称:azure-powershell,代码行数:32,代码来源:GetAzureRmLogProfileTests.cs

示例8: ProcessRecordInternal

        /// <summary>
        /// Execute the cmdlet
        /// </summary>
        protected override void ProcessRecordInternal()
        {
            WriteWarning("The output of this cmdlet will change. The cmdlet will not return anything in future releases.");
            var result = this.InsightsManagementClient.AutoscaleSettings.DeleteWithHttpMessagesAsync(resourceGroupName: this.ResourceGroup, autoscaleSettingName: this.Name).Result;

            // Keep this response for backwards compatibility.
            // Note: Delete operations return nothing in the new specification.
            var response = new AzureOperationResponse
            {
                // There is no data about the request Id in the new SDK .Net.
                RequestId = result.RequestId,
                StatusCode = HttpStatusCode.OK
            };

            WriteObject(response);
        }
开发者ID:Azure,项目名称:azure-powershell,代码行数:19,代码来源:RemoveAzureRmAutoscaleSettingCommand.cs

示例9: GetAndroidPolicies_ReturnsValidItem_Test

        public void GetAndroidPolicies_ReturnsValidItem_Test()
        {
            // Set up the expected Policy

            var expectedRespose = new AzureOperationResponse<IPage<IOSMAMPolicy>>();

            string expectedPolicyResBody = "{\r\n  \"value\": [\r\n    {\r\n      \"id\": \"/providers/Microsoft.Intune/locations/fef.dmsua01/androidPolicies/05207a60-6afd-4fd0-a8a8-e4e54bc11aa5\",\r\n      \"name\": \"05207a60-6afd-4fd0-a8a8-e4e54bc11aa5\",\r\n      \"type\": \"Microsoft.Intune/locations/androidPolicies\",\r\n      \"properties\": {\r\n        \"screenCapture\": \"allow\",\r\n        \"fileEncryption\": \"required\",\r\n        \"friendlyName\": \"IntuneAndroidPolicy4872\",\r\n        \"description\": \"New Ios Policy\",\r\n        \"accessRecheckOfflineTimeout\": \"P0DT12H00M\",\r\n        \"accessRecheckOnlineTimeout\": \"P0DT00H30M\",\r\n        \"appSharingFromLevel\": \"none\",\r\n        \"appSharingToLevel\": \"none\",\r\n        \"authentication\": \"required\",\r\n        \"clipboardSharingLevel\": \"blocked\",\r\n        \"dataBackup\": \"allow\",\r\n        \"deviceCompliance\": \"enable\",\r\n        \"managedBrowser\": \"required\",\r\n        \"fileSharingSaveAs\": \"allow\",\r\n        \"offlineWipeTimeout\": \"P1D\",\r\n        \"pin\": \"required\",\r\n        \"pinNumRetry\": 15,\r\n        \"numOfApps\": 0,\r\n        \"groupStatus\": \"notTargeted\",\r\n        \"lastModifiedTime\": \"2015-11-12T20:29:48.0885169\"\r\n      }\r\n    },\r\n    {\r\n      \"id\": \"/providers/Microsoft.Intune/locations/fef.dmsua01/androidPolicies/0f85f3de-172b-4867-9c8c-61dcf8798515\",\r\n      \"name\": \"0f85f3de-172b-4867-9c8c-61dcf8798515\",\r\n      \"type\": \"Microsoft.Intune/locations/androidPolicies\",\r\n      \"properties\": {\r\n        \"screenCapture\": \"allow\",\r\n        \"fileEncryption\": \"required\",\r\n        \"friendlyName\": \"IntuneAndroidPolicy542\",\r\n        \"description\": \"New Ios Policy\",\r\n        \"accessRecheckOfflineTimeout\": \"P0DT12H00M\",\r\n        \"accessRecheckOnlineTimeout\": \"P0DT00H30M\",\r\n        \"appSharingFromLevel\": \"none\",\r\n        \"appSharingToLevel\": \"none\",\r\n        \"authentication\": \"required\",\r\n        \"clipboardSharingLevel\": \"blocked\",\r\n        \"dataBackup\": \"allow\",\r\n        \"deviceCompliance\": \"enable\",\r\n        \"managedBrowser\": \"required\",\r\n        \"fileSharingSaveAs\": \"allow\",\r\n        \"offlineWipeTimeout\": \"P1D\",\r\n        \"pin\": \"required\",\r\n        \"pinNumRetry\": 15,\r\n        \"numOfApps\": 0,\r\n        \"groupStatus\": \"notTargeted\",\r\n        \"lastModifiedTime\": \"2015-11-12T20:30:56.7433738\"\r\n      }\r\n    },\r\n    {\r\n      \"id\": \"/providers/Microsoft.Intune/locations/fef.dmsua01/androidPolicies/1e5326cd-1d14-45df-a2b6-217e89a51b84\",\r\n      \"name\": \"1e5326cd-1d14-45df-a2b6-217e89a51b84\",\r\n      \"type\": \"Microsoft.Intune/locations/androidPolicies\",\r\n      \"properties\": {\r\n        \"screenCapture\": \"allow\",\r\n        \"fileEncryption\": \"required\",\r\n        \"friendlyName\": \"IntuneAndroidPolicy2587\",\r\n        \"description\": \"New Ios Policy\",\r\n        \"accessRecheckOfflineTimeout\": \"P0DT12H00M\",\r\n        \"accessRecheckOnlineTimeout\": \"P0DT00H30M\",\r\n        \"appSharingFromLevel\": \"none\",\r\n        \"appSharingToLevel\": \"none\",\r\n        \"authentication\": \"required\",\r\n        \"clipboardSharingLevel\": \"blocked\",\r\n        \"dataBackup\": \"allow\",\r\n        \"deviceCompliance\": \"enable\",\r\n        \"managedBrowser\": \"required\",\r\n        \"fileSharingSaveAs\": \"allow\",\r\n        \"offlineWipeTimeout\": \"P1D\",\r\n        \"pin\": \"required\",\r\n        \"pinNumRetry\": 15,\r\n        \"numOfApps\": 0,\r\n        \"groupStatus\": \"notTargeted\",\r\n        \"lastModifiedTime\": \"2015-11-12T20:29:50.5728801\"\r\n      }\r\n    },\r\n    {\r\n      \"id\": \"/providers/Microsoft.Intune/locations/fef.dmsua01/androidPolicies/485cacb6-4c14-4530-b9eb-319f380201de\",\r\n      \"name\": \"485cacb6-4c14-4530-b9eb-319f380201de\",\r\n      \"type\": \"Microsoft.Intune/locations/androidPolicies\",\r\n      \"properties\": {\r\n        \"screenCapture\": \"allow\",\r\n        \"fileEncryption\": \"required\",\r\n        \"friendlyName\": \"IntuneAndroidPolicy3818\",\r\n        \"description\": \"New Ios Policy\",\r\n        \"accessRecheckOfflineTimeout\": \"P0DT12H00M\",\r\n        \"accessRecheckOnlineTimeout\": \"P0DT00H30M\",\r\n        \"appSharingFromLevel\": \"none\",\r\n        \"appSharingToLevel\": \"none\",\r\n        \"authentication\": \"required\",\r\n        \"clipboardSharingLevel\": \"blocked\",\r\n        \"dataBackup\": \"allow\",\r\n        \"deviceCompliance\": \"enable\",\r\n        \"managedBrowser\": \"required\",\r\n        \"fileSharingSaveAs\": \"allow\",\r\n        \"offlineWipeTimeout\": \"P1D\",\r\n        \"pin\": \"required\",\r\n        \"pinNumRetry\": 15,\r\n        \"numOfApps\": 0,\r\n        \"groupStatus\": \"notTargeted\",\r\n        \"lastModifiedTime\": \"2015-11-12T20:31:02.853748\"\r\n      }\r\n    },\r\n    {\r\n      \"id\": \"/providers/Microsoft.Intune/locations/fef.dmsua01/androidPolicies/ab511ef4-fae7-4b88-8de1-ebfe8b89775c\",\r\n      \"name\": \"ab511ef4-fae7-4b88-8de1-ebfe8b89775c\",\r\n      \"type\": \"Microsoft.Intune/locations/androidPolicies\",\r\n      \"properties\": {\r\n        \"screenCapture\": \"allow\",\r\n        \"fileEncryption\": \"required\",\r\n        \"friendlyName\": \"IntuneAndroidPolicy3156\",\r\n        \"description\": \"New Ios Policy\",\r\n        \"accessRecheckOfflineTimeout\": \"P0DT12H00M\",\r\n        \"accessRecheckOnlineTimeout\": \"P0DT00H30M\",\r\n        \"appSharingFromLevel\": \"none\",\r\n        \"appSharingToLevel\": \"none\",\r\n        \"authentication\": \"required\",\r\n        \"clipboardSharingLevel\": \"blocked\",\r\n        \"dataBackup\": \"allow\",\r\n        \"deviceCompliance\": \"enable\",\r\n        \"managedBrowser\": \"required\",\r\n        \"fileSharingSaveAs\": \"allow\",\r\n        \"offlineWipeTimeout\": \"P1D\",\r\n        \"pin\": \"required\",\r\n        \"pinNumRetry\": 15,\r\n        \"numOfApps\": 0,\r\n        \"groupStatus\": \"notTargeted\",\r\n        \"lastModifiedTime\": \"2015-11-12T20:11:28.8676537\"\r\n      }\r\n    },\r\n    {\r\n      \"id\": \"/providers/Microsoft.Intune/locations/fef.dmsua01/androidPolicies/b4a51113-0c80-48f8-a1ec-f18ebff0a4b0\",\r\n      \"name\": \"b4a51113-0c80-48f8-a1ec-f18ebff0a4b0\",\r\n      \"type\": \"Microsoft.Intune/locations/androidPolicies\",\r\n      \"properties\": {\r\n        \"screenCapture\": \"allow\",\r\n        \"fileEncryption\": \"required\",\r\n        \"friendlyName\": \"IntuneAndroidPolicy8044\",\r\n        \"description\": \"New Ios Policy\",\r\n        \"accessRecheckOfflineTimeout\": \"P0DT12H00M\",\r\n        \"accessRecheckOnlineTimeout\": \"P0DT00H30M\",\r\n        \"appSharingFromLevel\": \"none\",\r\n        \"appSharingToLevel\": \"none\",\r\n        \"authentication\": \"required\",\r\n        \"clipboardSharingLevel\": \"blocked\",\r\n        \"dataBackup\": \"allow\",\r\n        \"deviceCompliance\": \"enable\",\r\n        \"managedBrowser\": \"required\",\r\n        \"fileSharingSaveAs\": \"allow\",\r\n        \"offlineWipeTimeout\": \"P1D\",\r\n        \"pin\": \"required\",\r\n        \"pinNumRetry\": 15,\r\n        \"numOfApps\": 0,\r\n        \"groupStatus\": \"notTargeted\",\r\n        \"lastModifiedTime\": \"2015-11-12T23:53:00.7365543\"\r\n      }\r\n    },\r\n    {\r\n      \"id\": \"/providers/Microsoft.Intune/locations/fef.dmsua01/androidPolicies/e3059837-8d02-4dbd-a166-4c620950db3a\",\r\n      \"name\": \"e3059837-8d02-4dbd-a166-4c620950db3a\",\r\n      \"type\": \"Microsoft.Intune/locations/androidPolicies\",\r\n      \"properties\": {\r\n        \"screenCapture\": \"allow\",\r\n        \"fileEncryption\": \"required\",\r\n        \"friendlyName\": \"IntuneAndroidPolicy67\",\r\n        \"description\": \"New Ios Policy\",\r\n        \"accessRecheckOfflineTimeout\": \"P0DT12H00M\",\r\n        \"accessRecheckOnlineTimeout\": \"P0DT00H30M\",\r\n        \"appSharingFromLevel\": \"none\",\r\n        \"appSharingToLevel\": \"none\",\r\n        \"authentication\": \"required\",\r\n        \"clipboardSharingLevel\": \"blocked\",\r\n        \"dataBackup\": \"allow\",\r\n        \"deviceCompliance\": \"enable\",\r\n        \"managedBrowser\": \"required\",\r\n        \"fileSharingSaveAs\": \"allow\",\r\n        \"offlineWipeTimeout\": \"P1D\",\r\n        \"pin\": \"required\",\r\n        \"pinNumRetry\": 15,\r\n        \"numOfApps\": 0,\r\n        \"groupStatus\": \"notTargeted\",\r\n        \"lastModifiedTime\": \"2015-11-12T23:53:01.1428402\"\r\n      }\r\n    }\r\n  ]\r\n}";

            var expectedResultPage = new Page<IOSMAMPolicy>();
            expectedResultPage = JsonConvert.DeserializeObject<Page<IOSMAMPolicy>>(expectedPolicyResBody, intuneClientMock.Object.DeserializationSettings);
            
            // Set expected Policy object
            var expectedMAMPolicy = new IOSMAMPolicy()
            {
                FriendlyName = "expectedPolicyFriendlyName",
                PinNumRetry = IntuneConstants.DefaultPinNumRetry,
                AccessRecheckOfflineTimeout = TimeSpan.FromMinutes(IntuneConstants.DefaultAccessRecheckOfflineTimeout),
                AccessRecheckOnlineTimeout = TimeSpan.FromMinutes(IntuneConstants.DefaultAccessRecheckOnlineTimeout),
                OfflineWipeTimeout = TimeSpan.FromDays(IntuneConstants.DefaultOfflineWipeTimeout),
            };

            expectedRespose.Body = expectedResultPage;

            // Set up the mock methods
            intuneClientMock.Setup(f => f.Ios.GetMAMPoliciesWithHttpMessagesAsync(
                    expectedLocation.HostName, 
                    It.IsAny<string>(), 
                    It.IsAny<int?>(),
                    It.IsAny<string>(),
                    It.IsAny<Dictionary<string, List<string>>>(), 
                    It.IsAny<CancellationToken>()))
                .Returns(Task.FromResult(expectedRespose));

            intuneClientMock.Setup(f => f.Ios.GetMAMPoliciesNextWithHttpMessagesAsync(
                    It.IsAny<string>(),
                    It.IsAny<Dictionary<string, List<string>>>(), It.IsAny<CancellationToken>()))
                .Returns(Task.FromResult(expectedRespose));

            commandRuntimeMock.Setup(m => m.ShouldProcess(It.IsAny<string>(), It.IsAny<string>()))
                .Returns(() => true);

            // Set cmdline args and execute the cmdlet
            this.cmdlet.ExecuteCmdlet();

            // Verify the result
            commandRuntimeMock.Verify(f => f.WriteObject(expectedResultPage, true), Times.Once());
        }
开发者ID:Azure,项目名称:azure-powershell,代码行数:47,代码来源:GetIntuneiOSMAMPolicyCmdletTests.cs

示例10: RemoveBatchAccountTest

        public void RemoveBatchAccountTest()
        {
            string accountName = "account01";
            string resourceGroup = "resourceGroup";

            AzureOperationResponse deleteResponse = new AzureOperationResponse();
            batchClientMock.Setup(b => b.DeleteAccount(resourceGroup, accountName)).Returns(deleteResponse);

            cmdlet.AccountName = accountName;
            cmdlet.ResourceGroupName = resourceGroup;

            cmdlet.Force = true;
            commandRuntimeMock.Setup(f => f.ShouldProcess(It.IsAny<string>(), It.IsAny<string>())).Returns(true);
            cmdlet.ExecuteCmdlet();

            batchClientMock.Verify(b => b.DeleteAccount(resourceGroup, accountName), Times.Once());
        }
开发者ID:randorfer,项目名称:azure-powershell,代码行数:17,代码来源:RemoveBatchAccountCommandTests.cs

示例11: AddIntuneAndroidMAMPolicyAppCmdletTests

        /// <summary>
        ///  C'tor for AddIntuneAndroidMAMPolicyAppCmdletTests class.
        /// </summary>
        public AddIntuneAndroidMAMPolicyAppCmdletTests()
        {
            commandRuntimeMock = new Mock<ICommandRuntime>();
            intuneClientMock = new Mock<IIntuneResourceManagementClient>();

            cmdlet = new AddIntuneAndroidMAMPolicyAppCmdlet();
            this.cmdlet.CommandRuntime = commandRuntimeMock.Object;
            this.cmdlet.IntuneClient = intuneClientMock.Object;

            // Set-up mock Location and mock the underlying service API method       
            AzureOperationResponse<Location> resLocation = new AzureOperationResponse<Location>();
            expectedLocation = new Location("mockHostName");
            resLocation.Body = expectedLocation;
    
            intuneClientMock.Setup(f => f.GetLocationByHostNameWithHttpMessagesAsync(It.IsAny<Dictionary<string, List<string>>>(), It.IsAny<CancellationToken>()))
                .Returns(Task.FromResult(resLocation));
        }
开发者ID:docschmidt,项目名称:azure-powershell,代码行数:20,代码来源:AddIntuneAndroidMAMPolicyAppCmdletTests.cs

示例12: GetIntuneiOSMAMAppCmdletTests

        /// <summary>
        ///  C'tor for GetIntuneApplicationCmdletTests class.
        /// </summary>
        public GetIntuneiOSMAMAppCmdletTests(ITestOutputHelper output)
        {
            XunitTracingInterceptor.AddToContext(new XunitTracingInterceptor(output));
            commandRuntimeMock = new Mock<ICommandRuntime>();
            intuneClientMock = new Mock<IIntuneResourceManagementClient>();

            cmdlet = new GetIntuneiOSMAMAppCmdlet();
            this.cmdlet.CommandRuntime = commandRuntimeMock.Object;
            this.cmdlet.IntuneClient = intuneClientMock.Object;

            // Set-up mock Location and mock the underlying service API method       
            AzureOperationResponse<Location> resLocation = new AzureOperationResponse<Location>();
            expectedLocation = new Location("mockHostName");
            resLocation.Body = expectedLocation;

            intuneClientMock.Setup(f => f.GetLocationByHostNameWithHttpMessagesAsync(It.IsAny<Dictionary<string, List<string>>>(), It.IsAny<CancellationToken>()))
                .Returns(Task.FromResult(resLocation));
        }
开发者ID:Azure,项目名称:azure-powershell,代码行数:21,代码来源:GetIntuneiOSMAMAppCmdletTests.cs

示例13: NewIntuneiOSMAMPolicy_WithDefaultArgs_Test

        public void NewIntuneiOSMAMPolicy_WithDefaultArgs_Test()
        {
            AzureOperationResponse<IOSMAMPolicy> resIosPolicy = new AzureOperationResponse<IOSMAMPolicy>();

            // Set expected Policy object
            var expectedMAMPolicy = new IOSMAMPolicy()
            {   
                FriendlyName = "expectedPolicyFriendlyName",
                PinNumRetry = IntuneConstants.DefaultPinNumRetry,
                AccessRecheckOfflineTimeout = TimeSpan.FromMinutes(IntuneConstants.DefaultAccessRecheckOfflineTimeout),
                AccessRecheckOnlineTimeout = TimeSpan.FromMinutes(IntuneConstants.DefaultAccessRecheckOnlineTimeout),
                OfflineWipeTimeout = TimeSpan.FromDays(IntuneConstants.DefaultOfflineWipeTimeout),
            };

            resIosPolicy.Body = expectedMAMPolicy;

            IOSMAMPolicy actualPolicyObj = new IOSMAMPolicy();

            // Mock the Underlying Service API method
            intuneClientMock.Setup(f => f.Ios.CreateOrUpdateMAMPolicyWithHttpMessagesAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<IOSMAMPolicy>(), It.IsAny<Dictionary<string, List<string>>>(), It.IsAny<CancellationToken>()))
                .Returns(Task.FromResult(resIosPolicy)).Callback((string hostName, string s, IOSMAMPolicy pObj, Dictionary<string, List<string>> dict, CancellationToken cTkn) => { actualPolicyObj = pObj; });
            
            // Mock the PowerShell RunTime method
            commandRuntimeMock.Setup(m => m.ShouldProcess(It.IsAny<string>(), It.IsAny<string>()))
                .Returns(() => true);
              
            // Set the cmdline args and execute the cmdlet            
            this.cmdlet.FriendlyName = expectedMAMPolicy.FriendlyName;

            this.cmdlet.ExecuteCmdlet();
            
            // Verify the params which are set with Default values
            Assert.Equal(expectedMAMPolicy.FriendlyName, actualPolicyObj.FriendlyName);
            Assert.Equal(expectedMAMPolicy.Name, actualPolicyObj.Id);
            Assert.Equal(expectedMAMPolicy.Id, actualPolicyObj.Name);
            Assert.Equal(expectedMAMPolicy.PinNumRetry, actualPolicyObj.PinNumRetry);        
            Assert.Equal(expectedMAMPolicy.OfflineWipeTimeout, actualPolicyObj.OfflineWipeTimeout);
            Assert.Equal(expectedMAMPolicy.AccessRecheckOfflineTimeout, actualPolicyObj.AccessRecheckOfflineTimeout);
            Assert.Equal(expectedMAMPolicy.AccessRecheckOnlineTimeout, actualPolicyObj.AccessRecheckOnlineTimeout);

            commandRuntimeMock.Verify(f => f.WriteObject(expectedMAMPolicy), Times.Once());        
        }
开发者ID:Azure,项目名称:azure-powershell,代码行数:42,代码来源:NewIntuneiOSMAMPolicyCmdletTests.cs

示例14: SetIntuneAndroidMAMPolicyCmdlet_WithValidArgs_Test

        public void SetIntuneAndroidMAMPolicyCmdlet_WithValidArgs_Test()
        {  
            // Set up the expected Policy
            var resPolicy = new AzureOperationResponse<AndroidMAMPolicy>();

            var expectedMAMPolicy = new AndroidMAMPolicy()
            {
                FriendlyName = "expectedPolicyFriendlyName",              
                OfflineWipeTimeout = TimeSpan.FromDays(100),
                AccessRecheckOfflineTimeout = TimeSpan.FromMinutes(2),
                AccessRecheckOnlineTimeout = TimeSpan.FromMinutes(3),
            };

            resPolicy.Body = expectedMAMPolicy;
            
            AndroidMAMPolicy actualPolicyObj = new AndroidMAMPolicy();

            // Set up the mock methods
            intuneClientMock.Setup(f => f.Android.PatchMAMPolicyWithHttpMessagesAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<AndroidMAMPolicy>(), It.IsAny<Dictionary<string, List<string>>>(), It.IsAny<CancellationToken>()))
               .Returns(Task.FromResult(resPolicy)).Callback((string hostName, string s, AndroidMAMPolicy pObj, Dictionary<string, List<string>> dict, CancellationToken cTkn) => { actualPolicyObj = pObj; });
           
            commandRuntimeMock.Setup(m => m.ShouldProcess(It.IsAny<string>(), It.IsAny<string>()))
                .Returns(() => true);

            // Set cmdline args and Execute the cmdlet
            this.cmdlet.Force = true;
            this.cmdlet.FriendlyName = expectedMAMPolicy.FriendlyName;     
            this.cmdlet.AccessRecheckOfflineTimeout = expectedMAMPolicy.AccessRecheckOfflineTimeout.Value.Minutes;
            this.cmdlet.AccessRecheckOnlineTimeout = expectedMAMPolicy.AccessRecheckOnlineTimeout.Value.Minutes;
            this.cmdlet.OfflineWipeTimeout = expectedMAMPolicy.OfflineWipeTimeout.Value.Days;

            this.cmdlet.ExecuteCmdlet();

            // Verify the result
            Assert.Equal(expectedMAMPolicy.FriendlyName, actualPolicyObj.FriendlyName);
            Assert.Equal(expectedMAMPolicy.OfflineWipeTimeout, actualPolicyObj.OfflineWipeTimeout);
            Assert.Equal(expectedMAMPolicy.AccessRecheckOfflineTimeout, actualPolicyObj.AccessRecheckOfflineTimeout);
            Assert.Equal(expectedMAMPolicy.AccessRecheckOnlineTimeout, actualPolicyObj.AccessRecheckOnlineTimeout);

            commandRuntimeMock.Verify(f => f.WriteObject(expectedMAMPolicy), Times.Once());
        }
开发者ID:Azure,项目名称:azure-powershell,代码行数:41,代码来源:SetIntuneAndroidMAMPolicyCmdletTests.cs

示例15: GetIntuneMAMUserDevices_ReturnsValidItem_Test

        public void GetIntuneMAMUserDevices_ReturnsValidItem_Test()
        {
            // Set up the expected Policy            
            string expectedUserDevices = "{\r\n  \"value\": [\r\n    {\r\n      \"id\": \"/providers/Microsoft.Intune/locations/fef.bmsua01/users/f4058390-f6d0-459b-9c36-3cf9d88e87f5/devices/8693b393-a69c-4d12-a9c8-a1a415884fd2\",\r\n      \"name\": \"8693b393-a69c-4d12-a9c8-a1a415884fd2\",\r\n      \"type\": \"Microsoft.Intune/locations/users/devices\",\r\n      \"properties\": {\r\n        \"userId\": \"f4058390-f6d0-459b-9c36-3cf9d88e87f5\",\r\n        \"friendlyName\": \"TestIpad\",\r\n        \"platform\": \"IOS\",\r\n        \"platformVersion\": \"9.0\",\r\n        \"deviceType\": \"TestIpad\"\r\n      }\r\n    },\r\n    {\r\n      \"id\": \"/providers/Microsoft.Intune/locations/fef.bmsua01/users/f4058390-f6d0-459b-9c36-3cf9d88e87f5/devices/38BBFA62-371F-4AA8-BFDB-846EBD47A86A\",\r\n      \"name\": \"38BBFA62-371F-4AA8-BFDB-846EBD47A86A\",\r\n      \"type\": \"Microsoft.Intune/locations/users/devices\",\r\n      \"properties\": {\r\n        \"userId\": \"f4058390-f6d0-459b-9c36-3cf9d88e87f5\",\r\n        \"friendlyName\": \"iPad\",\r\n        \"platform\": \"IOS\",\r\n        \"platformVersion\": \"8.1\",\r\n        \"deviceType\": \"iPad\"\r\n      }\r\n    }\r\n  ]\r\n}";

            var expectedRespose = new AzureOperationResponse<IPage<Device>>();

            IPage<Device> expectedResultPage = new Page<Device>();

            expectedResultPage = JsonConvert.DeserializeObject<Page<Device>>(expectedUserDevices, intuneClientMock.Object.DeserializationSettings);

            expectedRespose.Body = expectedResultPage;

            // Set up the mock methods
            intuneClientMock.Setup(f => f.GetMAMUserDevicesWithHttpMessagesAsync(
                    expectedLocation.HostName,
                    It.IsAny<string>(),
                    It.IsAny<string>(),
                    It.IsAny<int?>(),
                    It.IsAny<string>(),
                    It.IsAny<Dictionary<string, List<string>>>(),
                    It.IsAny<CancellationToken>()))
                .Returns(Task.FromResult(expectedRespose));

            intuneClientMock.Setup(f => f.GetMAMUserDevicesNextWithHttpMessagesAsync(
                    It.IsAny<string>(),
                    It.IsAny<Dictionary<string, List<string>>>(), It.IsAny<CancellationToken>()))
                .Returns(Task.FromResult(expectedRespose));

            commandRuntimeMock.Setup(m => m.ShouldProcess(It.IsAny<string>(), It.IsAny<string>()))
                .Returns(() => true);

            // Set cmdline args and execute the cmdlet
            this.cmdlet.ExecuteCmdlet();

            // Verify the result
            commandRuntimeMock.Verify(f => f.WriteObject(expectedResultPage, true), Times.Once());
        }
开发者ID:Azure,项目名称:azure-powershell,代码行数:38,代码来源:GetIntuneMAMUserDeviceCmdletTests.cs


注:本文中的AzureOperationResponse类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。