public void AddIntuneiOSMAMPolicyGroupCmdlet_WithValidArgs_Test() { // Set up the expected Policy var res = new Microsoft.Rest.Azure.AzureOperationResponse(); IOSMAMPolicy actualPolicyObj = new IOSMAMPolicy(); intuneClientMock.SetupAllProperties(); intuneClientMock.SetupGet(x => x.BaseUri).Returns(new Uri("http://expectedBaseUri")); // Set up the mock methods intuneClientMock.Setup(f => f.Ios.AddGroupForMAMPolicyWithHttpMessagesAsync( expectedLocation.HostName, It.IsAny <string>(), It.IsAny <string>(), It.IsAny <MAMPolicyAppIdOrGroupIdPayload>(), It.IsAny <Dictionary <string, List <string> > >(), It.IsAny <CancellationToken>())) .Returns(Task.FromResult(res)); commandRuntimeMock.Setup(m => m.ShouldProcess(It.IsAny <string>(), It.IsAny <string>())) .Returns(() => true); // Set cmdline args and execute the cmdlet this.cmdlet.ExecuteCmdlet(); }
/// <summary> /// Prepares iOS Policy body for the new policy request /// </summary> /// <returns>policy request body</returns> private IOSMAMPolicy PrepareIOSPolicyBody() { var policyBody = new IOSMAMPolicy() { FriendlyName = this.FriendlyName, Description = this.Description, AppSharingFromLevel = this.AppSharingFromLevel.ToString(), AppSharingToLevel = this.AppSharingToLevel.ToString(), Authentication = this.Authentication.ToString(), ClipboardSharingLevel = this.ClipboardSharingLevel.ToString(), DataBackup = this.DataBackup.ToString(), FileSharingSaveAs = this.FileSharingSaveAs.ToString(), Pin = this.Pin.ToString(), PinNumRetry = this.PinNumRetry, DeviceCompliance = this.DeviceCompliance.ToString(), ManagedBrowser = this.ManagedBrowser.ToString(), AccessRecheckOfflineTimeout = TimeSpan.FromMinutes(this.AccessRecheckOfflineTimeout.Value), AccessRecheckOnlineTimeout = TimeSpan.FromMinutes(this.AccessRecheckOnlineTimeout.Value), OfflineWipeTimeout = TimeSpan.FromDays(this.OfflineWipeTimeout.Value), FileEncryptionLevel = this.FileEncryptionLevel.ToString(), TouchId = this.TouchId.ToString() }; return(policyBody); }
public void SetIntuneiOSMAMPolicy_WithInValidArgs_Test() { // Set-up the expected Policy var resIosPolicy = new AzureOperationResponse <IOSMAMPolicy>(); var expectedMAMPolicy = new IOSMAMPolicy() { FriendlyName = "expectedPolicyFriendlyName", }; intuneClientMock.Setup(f => f.Ios.PatchMAMPolicyWithHttpMessagesAsync(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <IOSMAMPolicy>(), It.IsAny <Dictionary <string, List <string> > >(), It.IsAny <CancellationToken>())) .Returns(Task.FromResult(resIosPolicy)); commandRuntimeMock.Setup(m => m.ShouldProcess(It.IsAny <string>(), It.IsAny <string>())) .Returns(() => true); // Set the cmdline args and execute the cmdlet this.cmdlet.FriendlyName = "expectedPolicyFriendlyName"; this.cmdlet.Force = true; this.cmdlet.PinNumRetry = -1; try { this.cmdlet.ExecuteCmdlet(); } catch (Exception e) { // Verify the result Assert.IsType <PSArgumentOutOfRangeException>(e); commandRuntimeMock.Verify(f => f.WriteObject(expectedMAMPolicy), Times.Never()); } }
public void AddIntuneiOSMAMPolicyAppCmdlet_WithValidArgs_Test() { // Set up the expected Policy var res = new Microsoft.Rest.Azure.AzureOperationResponse(); IOSMAMPolicy actualPolicyObj = new IOSMAMPolicy(); intuneClientMock.SetupAllProperties(); intuneClientMock.SetupGet(x => x.BaseUri).Returns(new Uri("http://expectedBaseUri")); // Set up the mock methods intuneClientMock.Setup(f => f.Ios.AddAppForMAMPolicyWithHttpMessagesAsync( expectedLocation.HostName, It.IsAny<string>(), It.IsAny<string>(), It.IsAny<MAMPolicyAppIdOrGroupIdPayload>(), It.IsAny<Dictionary<string, List<string>>>(), It.IsAny<CancellationToken>())) .Returns(Task.FromResult(res)); commandRuntimeMock.Setup(m => m.ShouldProcess(It.IsAny<string>(), It.IsAny<string>())) .Returns(() => true); // Set cmdline args and execute the cmdlet this.cmdlet.ExecuteCmdlet(); }
/// <summary> /// Creates Or Updates iOS MAM Policy. /// </summary> public IOSMAMPolicy CreateOrUpdateIosMAMPolicy(string hostName, string policyId, IOSMAMPolicy policyParams) { if (this.Initialized) { IOSMAMPolicy iOSPolicy = this.IntuneClient.Ios.CreateOrUpdateMAMPolicy(hostName, policyId, policyParams); return(iOSPolicy); } else { throw new InvalidOperationException(Resources.NotInitializedErrorMessage); } }
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()); }
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()); }
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()); }
/// <summary> /// Prepares iOS Policy body for the new policy request /// </summary> /// <returns>policy request body</returns> private IOSMAMPolicy PrepareiOSMAMPolicyBody() { TimeSpan?accessRecheckOfflineTimeout = null, accessRecheckOnlineTimeout = null, offlineWipeTimeout = null; if (AccessRecheckOfflineTimeout.HasValue) { accessRecheckOfflineTimeout = TimeSpan.FromMinutes(AccessRecheckOfflineTimeout.Value); } if (AccessRecheckOnlineTimeout.HasValue) { accessRecheckOnlineTimeout = TimeSpan.FromMinutes(AccessRecheckOnlineTimeout.Value); } if (OfflineWipeTimeout.HasValue) { offlineWipeTimeout = TimeSpan.FromDays(OfflineWipeTimeout.Value); } var policyBody = new IOSMAMPolicy() { FriendlyName = this.FriendlyName, Description = this.Description, AppSharingFromLevel = this.AppSharingFromLevel.HasValue? AppSharingFromLevel.ToString():null, AppSharingToLevel = this.AppSharingToLevel.HasValue?this.AppSharingToLevel.ToString():null, Authentication = this.Authentication.HasValue?this.Authentication.ToString():null, ClipboardSharingLevel = this.ClipboardSharingLevel.HasValue?this.ClipboardSharingLevel.ToString():null, DataBackup = this.DataBackup.HasValue?this.DataBackup.ToString():null, FileSharingSaveAs = this.FileSharingSaveAs.HasValue?this.FileSharingSaveAs.ToString():null, Pin = this.Pin.HasValue?this.Pin.ToString():null, PinNumRetry = this.PinNumRetry, DeviceCompliance = this.DeviceCompliance.HasValue?this.DeviceCompliance.ToString():null, ManagedBrowser = this.ManagedBrowser.HasValue?this.ManagedBrowser.ToString():null, AccessRecheckOfflineTimeout = accessRecheckOfflineTimeout, AccessRecheckOnlineTimeout = accessRecheckOnlineTimeout, OfflineWipeTimeout = offlineWipeTimeout, FileEncryptionLevel = this.FileEncryptionLevel.HasValue?this.FileEncryptionLevel.ToString():null, TouchId = this.TouchId.HasValue?this.TouchId.ToString():null }; return(policyBody); }
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()); }
public void SetIntuneiOSMAMPolicy_WithValidArgs_Test() { // Set up the expected Policy var resPolicy = new AzureOperationResponse <IOSMAMPolicy>(); var expectedMAMPolicy = new IOSMAMPolicy() { FriendlyName = "expectedPolicyFriendlyName", OfflineWipeTimeout = TimeSpan.FromDays(100), AccessRecheckOfflineTimeout = TimeSpan.FromMinutes(2), AccessRecheckOnlineTimeout = TimeSpan.FromMinutes(3), }; resPolicy.Body = expectedMAMPolicy; IOSMAMPolicy actualPolicyObj = new IOSMAMPolicy(); intuneClientMock.Setup(f => f.Ios.PatchMAMPolicyWithHttpMessagesAsync(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <IOSMAMPolicy>(), It.IsAny <Dictionary <string, List <string> > >(), It.IsAny <CancellationToken>())) .Returns(Task.FromResult(resPolicy)).Callback((string hostName, string s, IOSMAMPolicy 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()); }
public void SetIntuneiOSMAMPolicy_WithValidArgs_Test() { // Set up the expected Policy var resPolicy = new AzureOperationResponse<IOSMAMPolicy>(); var expectedMAMPolicy = new IOSMAMPolicy() { FriendlyName = "expectedPolicyFriendlyName", OfflineWipeTimeout = TimeSpan.FromDays(100), AccessRecheckOfflineTimeout = TimeSpan.FromMinutes(2), AccessRecheckOnlineTimeout = TimeSpan.FromMinutes(3), }; resPolicy.Body = expectedMAMPolicy; IOSMAMPolicy actualPolicyObj = new IOSMAMPolicy(); intuneClientMock.Setup(f => f.Ios.PatchMAMPolicyWithHttpMessagesAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<IOSMAMPolicy>(), It.IsAny<Dictionary<string, List<string>>>(), It.IsAny<CancellationToken>())) .Returns(Task.FromResult(resPolicy)).Callback((string hostName, string s, IOSMAMPolicy 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()); }
/// <summary> /// patch an iOSMAMPolicy. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='hostName'> /// Location hostName for the tenant /// </param> /// <param name='policyName'> /// Unique name for the policy /// </param> /// <param name='parameters'> /// Parameters supplied to the Create or update an android policy operation. /// </param> public static IOSMAMPolicy PatchMAMPolicy(this IIosOperations operations, string hostName, string policyName, IOSMAMPolicy parameters) { return(Task.Factory.StartNew(s => ((IIosOperations)s).PatchMAMPolicyAsync(hostName, policyName, parameters), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
/// <summary> /// Creates Or Updates iOS MAM Policy. /// </summary> public IOSMAMPolicy CreateOrUpdateIosMAMPolicy(string hostName, string policyId, IOSMAMPolicy policyParams) { if (this.Initialized) { IOSMAMPolicy iOSPolicy = this.IntuneClient.Ios.CreateOrUpdateMAMPolicy(hostName, policyId, policyParams); return iOSPolicy; } else { throw new InvalidOperationException(Resources.NotInitializedErrorMessage); } }
public void SetIntuneiOSMAMPolicy_WithInValidArgs_Test() { // Set-up the expected Policy var resIosPolicy = new AzureOperationResponse<IOSMAMPolicy>(); var expectedMAMPolicy = new IOSMAMPolicy() { FriendlyName = "expectedPolicyFriendlyName", }; intuneClientMock.Setup(f => f.Ios.PatchMAMPolicyWithHttpMessagesAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<IOSMAMPolicy>(), It.IsAny<Dictionary<string, List<string>>>(), It.IsAny<CancellationToken>())) .Returns(Task.FromResult(resIosPolicy)); commandRuntimeMock.Setup(m => m.ShouldProcess(It.IsAny<string>(), It.IsAny<string>())) .Returns(() => true); // Set the cmdline args and execute the cmdlet this.cmdlet.FriendlyName = "expectedPolicyFriendlyName"; this.cmdlet.Force = true; this.cmdlet.PinNumRetry = -1; try { this.cmdlet.ExecuteCmdlet(); } catch (Exception e) { // Verify the result Assert.IsType<PSArgumentOutOfRangeException>(e); commandRuntimeMock.Verify(f => f.WriteObject(expectedMAMPolicy), Times.Never()); } }
/// <summary> /// patch an iOSMAMPolicy. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='hostName'> /// Location hostName for the tenant /// </param> /// <param name='policyName'> /// Unique name for the policy /// </param> /// <param name='parameters'> /// Parameters supplied to the Create or update an android policy operation. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IOSMAMPolicy> PatchMAMPolicyAsync(this IIosOperations operations, string hostName, string policyName, IOSMAMPolicy parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.PatchMAMPolicyWithHttpMessagesAsync(hostName, policyName, parameters, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Prepares iOS Policy body for the new policy request /// </summary> /// <returns>policy request body</returns> private IOSMAMPolicy PrepareiOSMAMPolicyBody() { TimeSpan? accessRecheckOfflineTimeout = null, accessRecheckOnlineTimeout = null, offlineWipeTimeout = null; if (AccessRecheckOfflineTimeout.HasValue) { accessRecheckOfflineTimeout = TimeSpan.FromMinutes(AccessRecheckOfflineTimeout.Value); } if (AccessRecheckOnlineTimeout.HasValue) { accessRecheckOnlineTimeout = TimeSpan.FromMinutes(AccessRecheckOnlineTimeout.Value); } if (OfflineWipeTimeout.HasValue) { offlineWipeTimeout = TimeSpan.FromDays(OfflineWipeTimeout.Value); } var policyBody = new IOSMAMPolicy() { FriendlyName = this.FriendlyName, Description = this.Description, AppSharingFromLevel = this.AppSharingFromLevel.HasValue? AppSharingFromLevel.ToString():null, AppSharingToLevel = this.AppSharingToLevel.HasValue?this.AppSharingToLevel.ToString():null, Authentication = this.Authentication.HasValue?this.Authentication.ToString():null, ClipboardSharingLevel = this.ClipboardSharingLevel.HasValue?this.ClipboardSharingLevel.ToString():null, DataBackup = this.DataBackup.HasValue?this.DataBackup.ToString():null, FileSharingSaveAs = this.FileSharingSaveAs.HasValue?this.FileSharingSaveAs.ToString():null, Pin = this.Pin.HasValue?this.Pin.ToString():null, PinNumRetry = this.PinNumRetry, DeviceCompliance = this.DeviceCompliance.HasValue?this.DeviceCompliance.ToString():null, ManagedBrowser = this.ManagedBrowser.HasValue?this.ManagedBrowser.ToString():null, AccessRecheckOfflineTimeout = accessRecheckOfflineTimeout, AccessRecheckOnlineTimeout = accessRecheckOnlineTimeout, OfflineWipeTimeout = offlineWipeTimeout, FileEncryptionLevel = this.FileEncryptionLevel.HasValue?this.FileEncryptionLevel.ToString():null, TouchId = this.TouchId.HasValue?this.TouchId.ToString():null }; return policyBody; }
/// <summary> /// Prepares iOS Policy body for the new policy request /// </summary> /// <returns>policy request body</returns> private IOSMAMPolicy PrepareIOSPolicyBody() { var policyBody = new IOSMAMPolicy() { FriendlyName = this.FriendlyName, Description = this.Description, AppSharingFromLevel = this.AppSharingFromLevel.ToString(), AppSharingToLevel = this.AppSharingToLevel.ToString(), Authentication = this.Authentication.ToString(), ClipboardSharingLevel = this.ClipboardSharingLevel.ToString(), DataBackup = this.DataBackup.ToString(), FileSharingSaveAs = this.FileSharingSaveAs.ToString(), Pin = this.Pin.ToString(), PinNumRetry = this.PinNumRetry, DeviceCompliance = this.DeviceCompliance.ToString(), ManagedBrowser = this.ManagedBrowser.ToString(), AccessRecheckOfflineTimeout = TimeSpan.FromMinutes(this.AccessRecheckOfflineTimeout.Value), AccessRecheckOnlineTimeout = TimeSpan.FromMinutes(this.AccessRecheckOnlineTimeout.Value), OfflineWipeTimeout = TimeSpan.FromDays(this.OfflineWipeTimeout.Value), FileEncryptionLevel = this.FileEncryptionLevel.ToString(), TouchId = this.TouchId.ToString() }; return policyBody; }