Skip to content

Commit ff26d82

Browse files
committed
Addressed PR comments.
1 parent 6ff49be commit ff26d82

File tree

46 files changed

+177
-674
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+177
-674
lines changed

src/ResourceManager/Intune/Commands.Intune.Test/Commands.Intune.Test.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@
6262
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.1.0.2\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
6363
<Private>True</Private>
6464
</Reference>
65-
<Reference Include="Microsoft.Azure.Management.Intune, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
65+
<Reference Include="Microsoft.Azure.Management.Intune, Version=0.1.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
6666
<SpecificVersion>False</SpecificVersion>
67-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Intune.0.1.2-preview\lib\net45\Microsoft.Azure.Management.Intune.dll</HintPath>
67+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Intune.0.1.3-preview\lib\net45\Microsoft.Azure.Management.Intune.dll</HintPath>
6868
<Private>True</Private>
6969
</Reference>
7070
<Reference Include="Microsoft.Azure.Management.WebSites, Version=0.9.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
@@ -178,6 +178,7 @@
178178
<Compile Include="Properties\AssemblyInfo.cs" />
179179
</ItemGroup>
180180
<ItemGroup>
181+
<None Include="app.config" />
181182
<None Include="MSSharedLibKey.snk" />
182183
<None Include="ScenarioTests\IntuneTests.ps1">
183184
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

src/ResourceManager/Intune/Commands.Intune.Test/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@
3333
// You can specify all the values or you can default the Build and Revision Numbers
3434
// by using the '*' as shown below:
3535
// [assembly: AssemblyVersion("1.0.*")]
36-
[assembly: AssemblyVersion("1.0.0.0")]
37-
[assembly: AssemblyFileVersion("1.0.0.0")]
36+
[assembly: AssemblyVersion("1.0.1")]
37+
[assembly: AssemblyFileVersion("1.0.1")]

src/ResourceManager/Intune/Commands.Intune.Test/UnitTests/Apps/AddIntuneAndroidMAMPolicyAppCmdletTests.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,7 @@ public void AddIntuneAndroidMAMPolicyAppCmdlet_WithValidArgs_Test()
8787
.Returns(() => true);
8888

8989
// Set cmdline args and execute the cmdlet
90-
this.cmdlet.Force = true;
91-
this.cmdlet.ExecuteCmdlet();
92-
93-
// Verify the result
94-
commandRuntimeMock.Verify(f => f.WriteObject("Operation completed successfully."), Times.Once());
90+
this.cmdlet.ExecuteCmdlet();
9591
}
9692
}
9793
}

src/ResourceManager/Intune/Commands.Intune.Test/UnitTests/Apps/AddIntuneiOSMAMPolicyAppCmdletTests.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,8 @@ public void AddIntuneiOSMAMPolicyAppCmdlet_WithValidArgs_Test()
8686
commandRuntimeMock.Setup(m => m.ShouldProcess(It.IsAny<string>(), It.IsAny<string>()))
8787
.Returns(() => true);
8888

89-
// Set cmdline args and execute the cmdlet
90-
this.cmdlet.Force = true;
91-
this.cmdlet.ExecuteCmdlet();
92-
93-
// Verify the result
94-
commandRuntimeMock.Verify(f => f.WriteObject("Operation completed successfully."), Times.Once());
89+
// Set cmdline args and execute the cmdlet
90+
this.cmdlet.ExecuteCmdlet();
9591
}
9692
}
9793
}

src/ResourceManager/Intune/Commands.Intune.Test/UnitTests/Apps/RemoveIntuneAndroidMAMPolicyAppCmdletTests.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,7 @@ public void RemoveIntuneAndroidMAMPolicyAppCmdletTests_OneItemDeleted_Test()
9393
this.cmdlet.Force = true;
9494
this.cmdlet.Name = expectedPolicyId;
9595

96-
this.cmdlet.ExecuteCmdlet();
97-
98-
// Verify the params which are set with Deafult values
99-
commandRuntimeMock.Verify(f => f.WriteObject("1 item deleted."), Times.Once());
96+
this.cmdlet.ExecuteCmdlet();
10097
}
10198

10299
/// <summary>
@@ -134,9 +131,6 @@ public void RemoveIntuneAndroidMAMPolicyAppCmdletTests_NoItemDeleted_Test()
134131
this.cmdlet.Name = expectedPolicyId;
135132

136133
this.cmdlet.ExecuteCmdlet();
137-
138-
// Verify the params which are set with Default values
139-
commandRuntimeMock.Verify(f => f.WriteObject("0 item deleted."), Times.Once());
140134
}
141135
}
142136
}

src/ResourceManager/Intune/Commands.Intune.Test/UnitTests/Apps/RemoveIntuneiOSMAMPolicyAppCmdletTests.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,7 @@ public void RemoveIntuneiOSMAMPolicyAppCmdletTests_OneItemDeleted_Test()
9292
// Set the cmdline args and execute the cmdlet
9393
this.cmdlet.Force = true;
9494
this.cmdlet.Name = expectedPolicyId;
95-
96-
this.cmdlet.ExecuteCmdlet();
97-
98-
// Verify the params which are set with Deafult values
99-
commandRuntimeMock.Verify(f => f.WriteObject("1 item deleted."), Times.Once());
95+
this.cmdlet.ExecuteCmdlet();
10096
}
10197

10298
/// <summary>
@@ -133,10 +129,7 @@ public void RemoveIntuneiOSMAMPolicyAppCmdletTests_NoItemDeleted_Test()
133129
this.cmdlet.Force = true;
134130
this.cmdlet.Name = expectedPolicyId;
135131

136-
this.cmdlet.ExecuteCmdlet();
137-
138-
// Verify the params which are set with Default values
139-
commandRuntimeMock.Verify(f => f.WriteObject("0 item deleted."), Times.Once());
132+
this.cmdlet.ExecuteCmdlet();
140133
}
141134
}
142135
}

src/ResourceManager/Intune/Commands.Intune.Test/UnitTests/Groups/AddIntuneAndroidMAMPolicyGroupCmdletTests.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,8 @@ public void AddIntuneAndroidMAMPolicyGroupCmdlet_WithValidArgs_Test()
8686
commandRuntimeMock.Setup(m => m.ShouldProcess(It.IsAny<string>(), It.IsAny<string>()))
8787
.Returns(() => true);
8888

89-
// Set cmdline args and execute the cmdlet
90-
this.cmdlet.Force = true;
91-
this.cmdlet.ExecuteCmdlet();
92-
93-
// Verify the result
94-
commandRuntimeMock.Verify(f => f.WriteObject("Operation completed successfully."), Times.Once());
89+
// Set cmdline args and execute the cmdlet
90+
this.cmdlet.ExecuteCmdlet();
9591
}
9692
}
9793
}

src/ResourceManager/Intune/Commands.Intune.Test/UnitTests/Groups/AddIntuneiOSMAMPolicyGroupCmdletTests.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,8 @@ public void AddIntuneiOSMAMPolicyGroupCmdlet_WithValidArgs_Test()
8686
commandRuntimeMock.Setup(m => m.ShouldProcess(It.IsAny<string>(), It.IsAny<string>()))
8787
.Returns(() => true);
8888

89-
// Set cmdline args and execute the cmdlet
90-
this.cmdlet.Force = true;
91-
this.cmdlet.ExecuteCmdlet();
92-
93-
// Verify the result
94-
commandRuntimeMock.Verify(f => f.WriteObject("Operation completed successfully."), Times.Once());
89+
// Set cmdline args and execute the cmdlet
90+
this.cmdlet.ExecuteCmdlet();
9591
}
9692
}
9793
}

src/ResourceManager/Intune/Commands.Intune.Test/UnitTests/Groups/RemoveIntuneAndroidMAMPolicyGroupCmdletTests.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,7 @@ public void RemoveIntuneAndroidMAMPolicyGroupCmdletTests_OneItemDeleted_Test()
9393
this.cmdlet.Force = true;
9494
this.cmdlet.Name = expectedPolicyId;
9595

96-
this.cmdlet.ExecuteCmdlet();
97-
98-
// Verify the params which are set with Deafult values
99-
commandRuntimeMock.Verify(f => f.WriteObject("1 item deleted."), Times.Once());
96+
this.cmdlet.ExecuteCmdlet();
10097
}
10198

10299
/// <summary>
@@ -133,10 +130,7 @@ public void RemoveIntuneAndroidMAMPolicyGroupCmdletTests_NoItemDeleted_Test()
133130
this.cmdlet.Force = true;
134131
this.cmdlet.Name = expectedPolicyId;
135132

136-
this.cmdlet.ExecuteCmdlet();
137-
138-
// Verify the params which are set with Default values
139-
commandRuntimeMock.Verify(f => f.WriteObject("0 item deleted."), Times.Once());
133+
this.cmdlet.ExecuteCmdlet();
140134
}
141135
}
142136
}

src/ResourceManager/Intune/Commands.Intune.Test/UnitTests/Groups/RemoveIntuneiOSMAMPolicyGroupCmdletTests.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,7 @@ public void RemoveIntuneiOSMAMPolicyGroupCmdlet_OneItemDeleted_Test()
9393
this.cmdlet.Force = true;
9494
this.cmdlet.Name = expectedPolicyId;
9595

96-
this.cmdlet.ExecuteCmdlet();
97-
98-
// Verify the params which are set with Deafult values
99-
commandRuntimeMock.Verify(f => f.WriteObject("1 item deleted."), Times.Once());
96+
this.cmdlet.ExecuteCmdlet();
10097
}
10198

10299
/// <summary>
@@ -133,10 +130,7 @@ public void RemoveIntuneiOSMAMPolicyGroupCmdletTests_NoItemDeleted_Test()
133130
this.cmdlet.Force = true;
134131
this.cmdlet.Name = expectedPolicyId;
135132

136-
this.cmdlet.ExecuteCmdlet();
137-
138-
// Verify the params which are set with Default values
139-
commandRuntimeMock.Verify(f => f.WriteObject("0 item deleted."), Times.Once());
133+
this.cmdlet.ExecuteCmdlet();
140134
}
141135
}
142136
}

src/ResourceManager/Intune/Commands.Intune.Test/UnitTests/Policy/NewIntuneAndroidMAMPolicyCmdletTests.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ public void NewIntuneAndroidMAMPolicyCmdlet_WithDefaultArgs_Test()
8989
commandRuntimeMock.Setup(m => m.ShouldProcess(It.IsAny<string>(), It.IsAny<string>()))
9090
.Returns(() => true);
9191

92-
// Set the cmdline args and Execute the cmdlet
93-
this.cmdlet.Force = true;
92+
// Set the cmdline args and Execute the cmdlet
9493
this.cmdlet.FriendlyName = expectedMAMPolicy.FriendlyName;
9594

9695
this.cmdlet.ExecuteCmdlet();
@@ -136,8 +135,7 @@ public void NewIntuneAndroidMAMPolicyCmdlet_WithValidArgs_Test()
136135
commandRuntimeMock.Setup(m => m.ShouldProcess(It.IsAny<string>(), It.IsAny<string>()))
137136
.Returns(() => true);
138137

139-
// Set cmdline args and Execute the cmdlet
140-
this.cmdlet.Force = true;
138+
// Set cmdline args and Execute the cmdlet
141139
this.cmdlet.FriendlyName = expectedMAMPolicy.FriendlyName;
142140
this.cmdlet.AccessRecheckOfflineTimeout = expectedMAMPolicy.AccessRecheckOfflineTimeout.Value.Minutes;
143141
this.cmdlet.AccessRecheckOnlineTimeout = expectedMAMPolicy.AccessRecheckOnlineTimeout.Value.Minutes;
@@ -179,8 +177,7 @@ public void NewIntuneAndroidMAMPolicyCmdlet_WithInValidArgs_Test()
179177
.Returns(() => true);
180178

181179
// Set the cmdline args and Execute the cmdlet
182-
this.cmdlet.FriendlyName = "expectedPolicyFriendlyName";
183-
this.cmdlet.Force = true;
180+
this.cmdlet.FriendlyName = "expectedPolicyFriendlyName";
184181
this.cmdlet.PinNumRetry = -1;
185182

186183
try

src/ResourceManager/Intune/Commands.Intune.Test/UnitTests/Policy/NewIntuneiOSMAMPolicyCmdletTests.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ public void NewIntuneiOSMAMPolicy_WithDefaultArgs_Test()
8989
commandRuntimeMock.Setup(m => m.ShouldProcess(It.IsAny<string>(), It.IsAny<string>()))
9090
.Returns(() => true);
9191

92-
// Set the cmdline args and execute the cmdlet
93-
this.cmdlet.Force = true;
92+
// Set the cmdline args and execute the cmdlet
9493
this.cmdlet.FriendlyName = expectedMAMPolicy.FriendlyName;
9594

9695
this.cmdlet.ExecuteCmdlet();
@@ -135,8 +134,7 @@ public void NewIntuneiOSMAMPolicy_WithValidArgs_Test()
135134
commandRuntimeMock.Setup(m => m.ShouldProcess(It.IsAny<string>(), It.IsAny<string>()))
136135
.Returns(() => true);
137136

138-
// Set cmdline args and execute the cmdlet
139-
this.cmdlet.Force = true;
137+
// Set cmdline args and execute the cmdlet
140138
this.cmdlet.FriendlyName = expectedMAMPolicy.FriendlyName;
141139
this.cmdlet.AccessRecheckOfflineTimeout = expectedMAMPolicy.AccessRecheckOfflineTimeout.Value.Minutes;
142140
this.cmdlet.AccessRecheckOnlineTimeout = expectedMAMPolicy.AccessRecheckOnlineTimeout.Value.Minutes;
@@ -175,8 +173,7 @@ public void NewIntuneiOSMAMPolicy_WithInValidArgs_Test()
175173
.Returns(() => true);
176174

177175
// Set the cmdline args and execute the cmdlet
178-
this.cmdlet.FriendlyName = "expectedPolicyFriendlyName";
179-
this.cmdlet.Force = true;
176+
this.cmdlet.FriendlyName = "expectedPolicyFriendlyName";
180177
this.cmdlet.PinNumRetry = -1;
181178

182179
try

src/ResourceManager/Intune/Commands.Intune.Test/UnitTests/Policy/RemoveIntuneAndroidMAMPolicyCmdletTests.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,7 @@ public void RemoveIntuneAndroidMAMPolicyCmdlet_OneItemDeleted_Test()
8686
this.cmdlet.Force = true;
8787
this.cmdlet.Name = expectedPolicyId;
8888

89-
this.cmdlet.ExecuteCmdlet();
90-
91-
// Verify the params which are set with Deafult values
92-
commandRuntimeMock.Verify(f => f.WriteObject("1 item deleted."), Times.Once());
89+
this.cmdlet.ExecuteCmdlet();
9390
}
9491

9592
/// <summary>
@@ -119,10 +116,7 @@ public void RemoveIntuneAndroidMAMPolicyCmdlet_NoItemDeleted_Test()
119116
this.cmdlet.Force = true;
120117
this.cmdlet.Name = expectedPolicyId;
121118

122-
this.cmdlet.ExecuteCmdlet();
123-
124-
// Verify the params which are set with Deafult values
125-
commandRuntimeMock.Verify(f => f.WriteObject("0 item deleted."), Times.Once());
119+
this.cmdlet.ExecuteCmdlet();
126120
}
127121
}
128122
}

src/ResourceManager/Intune/Commands.Intune.Test/UnitTests/Policy/RemoveIntuneiOSMAMPolicyCmdletTests.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,7 @@ public void RemoveIntuneIosMAMPolicyCmdlet_OneItemDeleted_Test()
8686
this.cmdlet.Force = true;
8787
this.cmdlet.Name = expectedPolicyId;
8888

89-
this.cmdlet.ExecuteCmdlet();
90-
91-
// Verify the params which are set with Deafult values
92-
commandRuntimeMock.Verify(f => f.WriteObject("1 item deleted."), Times.Once());
89+
this.cmdlet.ExecuteCmdlet();
9390
}
9491

9592
/// <summary>
@@ -119,10 +116,7 @@ public void RemoveIntuneIosMAMPolicyCmdlet_NoItemDeleted_Test()
119116
this.cmdlet.Force = true;
120117
this.cmdlet.Name = expectedPolicyId;
121118

122-
this.cmdlet.ExecuteCmdlet();
123-
124-
// Verify the params which are set with Deafult values
125-
commandRuntimeMock.Verify(f => f.WriteObject("0 item deleted."), Times.Once());
119+
this.cmdlet.ExecuteCmdlet();
126120
}
127121
}
128122
}

src/ResourceManager/Intune/Commands.Intune.Test/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<package id="Microsoft.Azure.Common" version="2.1.0" targetFramework="net45" />
55
<package id="Microsoft.Azure.Common.Authentication" version="1.4.1-preview" targetFramework="net45" />
66
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
7-
<package id="Microsoft.Azure.Management.Intune" version="0.1.2-preview" targetFramework="net45" />
7+
<package id="Microsoft.Azure.Management.Intune" version="0.1.3-preview" targetFramework="net45" />
88
<package id="Microsoft.Azure.Test.Framework" version="1.0.5785.18045-prerelease" targetFramework="net45" />
99
<package id="Microsoft.Azure.Test.HttpRecorder" version="1.3.0-preview" targetFramework="net45" />
1010
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net45" />

src/ResourceManager/Intune/Commands.Intune/Apps/AddIntuneAndroidMAMPolicyAppCmdlet.cs

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@ namespace Microsoft.Azure.Commands.Intune
1919
using Microsoft.Azure.Commands.Intune.Properties;
2020
using System.Globalization;
2121
using System.Management.Automation;
22+
using System.Net;
2223

2324
/// <summary>
2425
/// A cmdlet to link an app to Android Intune MAM policy Azure resource.
2526
/// </summary>
26-
[Cmdlet(VerbsCommon.Add, "AzureRmIntuneAndroidMAMPolicyApp", SupportsShouldProcess = true), OutputType(typeof(PSObject))]
27+
[Cmdlet(VerbsCommon.Add, "AzureRmIntuneAndroidMAMPolicyApp")]
2728
public sealed class AddIntuneAndroidMAMPolicyAppCmdlet : IntuneBaseCmdlet
2829
{
2930
/// <summary>
@@ -40,36 +41,13 @@ public sealed class AddIntuneAndroidMAMPolicyAppCmdlet : IntuneBaseCmdlet
4041
[ValidateNotNullOrEmpty]
4142
public string AppName { get; set; }
4243

43-
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Don't ask for confirmation.")]
44-
public SwitchParameter Force { get; set; }
4544
/// <summary>
4645
/// Executes the cmdlet.
4746
/// </summary>
4847
public override void ExecuteCmdlet()
4948
{
50-
this.ConfirmAction(
51-
this.Force,
52-
string.Format(
53-
CultureInfo.CurrentCulture,
54-
Resources.AddLinkedResouce_ActionMessage,
55-
Resources.App,
56-
this.AppName,
57-
Resources.AndroidPolicy,
58-
this.Name),
59-
string.Format(
60-
CultureInfo.CurrentCulture,
61-
Resources.AddLinkedResources_ProcessMessage,
62-
Resources.App,
63-
this.AppName,
64-
Resources.AndroidPolicy,
65-
this.Name),
66-
this.Name,
67-
() =>
68-
{
69-
var payLoad = AppOrGroupPayloadMaker.PrepareMAMPolicyPayload(this.IntuneClient, LinkType.App, this.AsuHostName, this.AppName);
70-
this.IntuneClient.Android.AddAppForMAMPolicy(this.AsuHostName, this.Name, this.AppName, payLoad);
71-
this.WriteObject(Resources.OperationCompletedMessage);
72-
});
49+
var payLoad = AppOrGroupPayloadMaker.PrepareMAMPolicyPayload(this.IntuneClient, LinkType.App, this.AsuHostName, this.AppName);
50+
this.IntuneClient.Android.AddAppForMAMPolicyWithHttpMessagesAsync(this.AsuHostName, this.Name, this.AppName, payLoad).GetAwaiter().GetResult();
7351
}
7452
}
7553
}

0 commit comments

Comments
 (0)