Skip to content

Commit 83a1642

Browse files
committed
[UVHD Tenant Admin] Add admin cmdlet to delete and copy UVHD
1 parent 0f5275c commit 83a1642

File tree

18 files changed

+839
-220
lines changed

18 files changed

+839
-220
lines changed

src/ServiceManagement/RemoteApp/Commands.RemoteApp.ScenarioTest/Commands.RemoteAppScenarioTest.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.4.1.1\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
8484
</Reference>
8585
<Reference Include="Microsoft.WindowsAzure.Management.RemoteApp, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
86-
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.RemoteApp.2.0.4\lib\net40\Microsoft.WindowsAzure.Management.RemoteApp.dll</HintPath>
86+
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.RemoteApp.2.0.6\lib\net40\Microsoft.WindowsAzure.Management.RemoteApp.dll</HintPath>
8787
</Reference>
8888
<Reference Include="Moq, Version=4.2.1510.2205, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
8989
<HintPath>..\..\..\packages\Moq.4.2.1510.2205\lib\net40\Moq.dll</HintPath>

src/ServiceManagement/RemoteApp/Commands.RemoteApp.Test/Collection/RemoteAppCollection.cs

Lines changed: 50 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
namespace Microsoft.WindowsAzure.Commands.RemoteApp.Test
1818
{
1919
using Common;
20+
using Microsoft.VisualStudio.TestTools.UnitTesting;
2021
using Microsoft.WindowsAzure.Management.RemoteApp;
2122
using Microsoft.WindowsAzure.Management.RemoteApp.Cmdlets;
2223
using Microsoft.WindowsAzure.Management.RemoteApp.Models;
@@ -29,14 +30,14 @@ namespace Microsoft.WindowsAzure.Commands.RemoteApp.Test
2930
using System.Management.Automation;
3031
using System.Threading;
3132
using System.Threading.Tasks;
32-
using Xunit;
3333

3434
// Get-AzureRemoteAppCollectionUsageDetails, Get-AzureRemoteAppCollectionUsageSummary,
35+
[TestClass]
3536
public class RemoteAppCollectionTest : RemoteAppClientTest
3637
{
3738

38-
[Fact]
39-
[Trait(Category.AcceptanceType, Category.CheckIn)]
39+
[TestMethod]
40+
[TestCategory("CheckIn")]
4041
public void GetAllCollections()
4142
{
4243
int countOfExpectedCollections = 0;
@@ -51,32 +52,32 @@ public void GetAllCollections()
5152
mockCmdlet.ExecuteCmdlet();
5253
if (mockCmdlet.runTime().ErrorStream.Count != 0)
5354
{
54-
Assert.True(false,
55+
Assert.IsTrue(false,
5556
String.Format("Get-AzureRemoteAppCollection returned the following error {0}.",
5657
mockCmdlet.runTime().ErrorStream[0].Exception.Message
5758
)
5859
);
5960
}
6061

6162
List<Collection> collections = MockObject.ConvertList<Collection>(mockCmdlet.runTime().OutputPipeline);
62-
Assert.NotNull(collections);
63+
Assert.IsNotNull(collections);
6364

64-
Assert.True(collections.Count == countOfExpectedCollections,
65+
Assert.IsTrue(collections.Count == countOfExpectedCollections,
6566
String.Format("The expected number of collections returned {0} does not match the actual {1}.",
6667
countOfExpectedCollections,
6768
collections.Count
6869
)
6970
);
7071

71-
Assert.True(MockObject.HasExpectedResults<Collection>(collections, MockObject.ContainsExpectedCollection),
72+
Assert.IsTrue(MockObject.HasExpectedResults<Collection>(collections, MockObject.ContainsExpectedCollection),
7273
"The actual result does not match the expected."
7374
);
7475

7576
Log("The test for Get-AzureRemoteAppCollection with {0} collections completed successfully", countOfExpectedCollections);
7677
}
7778

78-
[Fact]
79-
[Trait(Category.AcceptanceType, Category.CheckIn)]
79+
[TestMethod]
80+
[TestCategory("CheckIn")]
8081
public void GetCollectionsByName()
8182
{
8283
int countOfExpectedCollections = 1;
@@ -95,30 +96,30 @@ public void GetCollectionsByName()
9596

9697
if (mockCmdlet.runTime().ErrorStream.Count != 0)
9798
{
98-
Assert.True(false,
99+
Assert.IsTrue(false,
99100
String.Format("Get-AzureRemoteAppUser returned the following error {0}.",
100101
mockCmdlet.runTime().ErrorStream[0].Exception.Message
101102
)
102103
);
103104
}
104105

105106
List<Collection> collections = MockObject.ConvertList<Collection>(mockCmdlet.runTime().OutputPipeline);
106-
Assert.NotNull(collections);
107+
Assert.IsNotNull(collections);
107108

108-
Assert.True(collections.Count == countOfExpectedCollections,
109+
Assert.IsTrue(collections.Count == countOfExpectedCollections,
109110
String.Format("The expected number of collections returned {0} does not match the actual {1}.",
110111
countOfExpectedCollections,
111112
collections.Count
112113
)
113114
);
114115

115-
Assert.True(MockObject.HasExpectedResults<Collection>(collections, MockObject.ContainsExpectedCollection),
116+
Assert.IsTrue(MockObject.HasExpectedResults<Collection>(collections, MockObject.ContainsExpectedCollection),
116117
"The actual result does not match the expected."
117118
);
118119
}
119120

120-
[Fact]
121-
[Trait(Category.AcceptanceType, Category.CheckIn)]
121+
[TestMethod]
122+
[TestCategory("CheckIn")]
122123
public void AddCollection()
123124
{
124125
List<TrackingResult> trackingIds = null;
@@ -140,30 +141,30 @@ public void AddCollection()
140141
mockCmdlet.ExecuteCmdlet();
141142
if (mockCmdlet.runTime().ErrorStream.Count != 0)
142143
{
143-
Assert.True(false,
144+
Assert.IsTrue(false,
144145
String.Format("New-AzureRemoteAppCollection returned the following error {0}",
145146
mockCmdlet.runTime().ErrorStream[0].Exception.Message
146147
)
147148
);
148149
}
149150

150151
trackingIds = MockObject.ConvertList<TrackingResult>(mockCmdlet.runTime().OutputPipeline);
151-
Assert.NotNull(trackingIds);
152+
Assert.IsNotNull(trackingIds);
152153

153-
Assert.True(trackingIds.Count == countOfExpectedCollections,
154+
Assert.IsTrue(trackingIds.Count == countOfExpectedCollections,
154155
String.Format("The expected number of collections returned {0} does not match the actual {1}",
155156
countOfExpectedCollections,
156157
trackingIds.Count
157158
)
158159
);
159160

160-
Assert.True(MockObject.HasExpectedResults<TrackingResult>(trackingIds, MockObject.ContainsExpectedTrackingId),
161+
Assert.IsTrue(MockObject.HasExpectedResults<TrackingResult>(trackingIds, MockObject.ContainsExpectedTrackingId),
161162
"The actual result does not match the expected."
162163
);
163164
}
164165

165-
[Fact]
166-
[Trait(Category.AcceptanceType, Category.CheckIn)]
166+
[TestMethod]
167+
[TestCategory("CheckIn")]
167168
public void UpdateCollection()
168169
{
169170
List<TrackingResult> trackingIds = null;
@@ -182,29 +183,29 @@ public void UpdateCollection()
182183
mockCmdlet.ExecuteCmdlet();
183184
if (mockCmdlet.runTime().ErrorStream.Count != 0)
184185
{
185-
Assert.True(false,
186+
Assert.IsTrue(false,
186187
String.Format("New-AzureRemoteAppCollection returned the following error {0}",
187188
mockCmdlet.runTime().ErrorStream[0].Exception.Message
188189
)
189190
);
190191
}
191192

192193
trackingIds = MockObject.ConvertList<TrackingResult>(mockCmdlet.runTime().OutputPipeline);
193-
Assert.NotNull(trackingIds);
194+
Assert.IsNotNull(trackingIds);
194195

195-
Assert.True(trackingIds.Count == countOfExpectedCollections,
196+
Assert.IsTrue(trackingIds.Count == countOfExpectedCollections,
196197
String.Format("The expected number of collections returned {0} does not match the actual {1}",
197198
countOfExpectedCollections,
198199
trackingIds.Count
199200
)
200201
);
201202

202-
Assert.True(MockObject.HasExpectedResults<TrackingResult>(trackingIds, MockObject.ContainsExpectedTrackingId),
203+
Assert.IsTrue(MockObject.HasExpectedResults<TrackingResult>(trackingIds, MockObject.ContainsExpectedTrackingId),
203204
"The actual result does not match the expected."
204205
);
205206
}
206207

207-
[Fact]
208+
[TestMethod]
208209
public void PatchCollectionTest()
209210
{
210211
UpdateAzureRemoteAppCollection mockCmdlet = SetUpTestCommon<UpdateAzureRemoteAppCollection>();
@@ -231,8 +232,8 @@ public void PatchCollectionTest()
231232
PerfomrCollectionTestHelper(mockCmdlet, collectionName, expectedCollection, expectedTrackingId, requestData, true);
232233
}
233234

234-
[Fact]
235-
[Trait(Category.AcceptanceType, Category.CheckIn)]
235+
[TestMethod]
236+
[TestCategory("CheckIn")]
236237
public void SetCollection()
237238
{
238239
SetAzureRemoteAppCollection mockCmdlet = SetUpTestCommon<SetAzureRemoteAppCollection>();
@@ -259,7 +260,7 @@ public void SetCollection()
259260
PerfomrCollectionTestHelper(mockCmdlet, collectionName, expectedCollection, expectedTrackingId, requestData, false);
260261
}
261262

262-
[Fact]
263+
[TestMethod]
263264
public void SetCollectionCustomRdpPropertyTest()
264265
{
265266
SetAzureRemoteAppCollection mockCmdlet = SetUpTestCommon<SetAzureRemoteAppCollection>();
@@ -285,7 +286,7 @@ public void SetCollectionCustomRdpPropertyTest()
285286
PerfomrCollectionTestHelper(mockCmdlet, collectionName, expectedCollection, expectedTrackingId, requestData, false);
286287
}
287288

288-
[Fact]
289+
[TestMethod]
289290
public void SetCollectionDescriptionTest()
290291
{
291292
SetAzureRemoteAppCollection mockCmdlet = SetUpTestCommon<SetAzureRemoteAppCollection>();
@@ -367,17 +368,17 @@ private void PerformCollectionTestWithAdInfoHelper(
367368
cmdRuntime = mockCmdlet.runTime();
368369
if (cmdRuntime.ErrorStream.Count > 0)
369370
{
370-
Assert.True(cmdRuntime.ErrorStream.Count == 0,
371+
Assert.IsTrue(cmdRuntime.ErrorStream.Count == 0,
371372
String.Format("Set-AzureRemoteAppCollection returned the following error {0}",
372373
mockCmdlet.runTime().ErrorStream[0].Exception.Message));
373374
}
374375

375376
trackingIds = LanguagePrimitives.GetEnumerable(mockCmdlet.runTime().OutputPipeline).Cast<TrackingResult>();
376-
Assert.NotNull(trackingIds);
377+
Assert.IsNotNull(trackingIds);
377378

378-
Assert.Equal(1, trackingIds.Count());
379+
Assert.AreEqual(1, trackingIds.Count());
379380

380-
Assert.True(trackingIds.Any(t => t.TrackingId == trackingId), "The actual result does not match the expected.");
381+
Assert.IsTrue(trackingIds.Any(t => t.TrackingId == trackingId), "The actual result does not match the expected.");
381382
}
382383

383384

@@ -429,20 +430,20 @@ private void PerfomrCollectionTestHelper(
429430
cmdRuntime = mockCmdlet.runTime();
430431
if (cmdRuntime.ErrorStream.Count > 0)
431432
{
432-
Assert.True(cmdRuntime.ErrorStream.Count == 0,
433+
Assert.IsTrue(cmdRuntime.ErrorStream.Count == 0,
433434
String.Format("Set-AzureRemoteAppCollection returned the following error {0}",
434435
mockCmdlet.runTime().ErrorStream[0].Exception.Message));
435436
}
436437

437438
trackingIds = LanguagePrimitives.GetEnumerable(mockCmdlet.runTime().OutputPipeline).Cast<TrackingResult>();
438-
Assert.NotNull(trackingIds);
439+
Assert.IsNotNull(trackingIds);
439440

440-
Assert.Equal(1, trackingIds.Count());
441+
Assert.AreEqual(1, trackingIds.Count());
441442

442-
Assert.True(trackingIds.Any(t => t.TrackingId == trackingId), "The actual result does not match the expected.");
443+
Assert.IsTrue(trackingIds.Any(t => t.TrackingId == trackingId), "The actual result does not match the expected.");
443444
}
444445

445-
[Fact]
446+
[TestMethod]
446447
public void SetCollectionAdConfigTest()
447448
{
448449
SetAzureRemoteAppCollection mockCmdlet = SetUpTestCommon<SetAzureRemoteAppCollection>();
@@ -476,7 +477,7 @@ public void SetCollectionAdConfigTest()
476477
PerformCollectionTestWithAdInfoHelper(mockCmdlet, collectionName, expectedCollection, expectedTrackingId, requestData, false);
477478
}
478479

479-
[Fact]
480+
[TestMethod]
480481
public void SetInactiveCollectionAdConfigTest()
481482
{
482483
SetAzureRemoteAppCollection mockCmdlet = SetUpTestCommon<SetAzureRemoteAppCollection>();
@@ -510,7 +511,7 @@ public void SetInactiveCollectionAdConfigTest()
510511
PerformCollectionTestWithAdInfoHelper(mockCmdlet, collectionName, expectedCollection, expectedTrackingId, requestData, true);
511512
}
512513

513-
[Fact]
514+
[TestMethod]
514515
public void RemoveCollection()
515516
{
516517
List<TrackingResult> trackingIds = null;
@@ -529,25 +530,25 @@ public void RemoveCollection()
529530
mockCmdlet.ExecuteCmdlet();
530531
if (mockCmdlet.runTime().ErrorStream.Count != 0)
531532
{
532-
Assert.True(false,
533+
Assert.IsTrue(false,
533534
String.Format("Remove-AzureRemoteAppCollection returned the following error {0}",
534535
mockCmdlet.runTime().ErrorStream[0].Exception.Message
535536
)
536537
);
537538
}
538539

539540
trackingIds = MockObject.ConvertList<TrackingResult>(mockCmdlet.runTime().OutputPipeline);
540-
Assert.NotNull(trackingIds);
541+
Assert.IsNotNull(trackingIds);
541542

542-
Assert.True(MockObject.HasExpectedResults<TrackingResult>(trackingIds, MockObject.ContainsExpectedTrackingId),
543+
Assert.IsTrue(MockObject.HasExpectedResults<TrackingResult>(trackingIds, MockObject.ContainsExpectedTrackingId),
543544
"The actual result does not match the expected."
544545
);
545546

546547
Log("The test for Remove-AzureRemoteAppCollection completed successfully");
547548
}
548549

549-
[Fact]
550-
[Trait(Category.AcceptanceType, Category.CheckIn)]
550+
[TestMethod]
551+
[TestCategory("CheckIn")]
551552
public void GetRegionList()
552553
{
553554
List<Region> regionList = null;
@@ -562,17 +563,17 @@ public void GetRegionList()
562563
mockCmdlet.ExecuteCmdlet();
563564
if (mockCmdlet.runTime().ErrorStream.Count != 0)
564565
{
565-
Assert.True(false,
566+
Assert.IsTrue(false,
566567
String.Format("Get-AzureRemoteAppRegionList returned the following error {0}.",
567568
mockCmdlet.runTime().ErrorStream[0].Exception.Message
568569
)
569570
);
570571
}
571572

572573
regionList = MockObject.ConvertList<Region>(mockCmdlet.runTime().OutputPipeline);
573-
Assert.NotNull(regionList);
574+
Assert.IsNotNull(regionList);
574575

575-
Assert.True(MockObject.HasExpectedResults<Region>(regionList, MockObject.ContainsExpectedRegion),
576+
Assert.IsTrue(MockObject.HasExpectedResults<Region>(regionList, MockObject.ContainsExpectedRegion),
576577
"The actual result does not match the expected."
577578
);
578579

src/ServiceManagement/RemoteApp/Commands.RemoteApp.Test/Commands.RemoteApp.Test.csproj

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
<ItemGroup>
4343
<Compile Include="Collection\RemoteAppCollection.cs" />
4444
<Compile Include="Common\MockAdHelper.cs" />
45+
<Compile Include="Common\UserDiskObjects.cs" />
4546
<Compile Include="Common\VmObjects.cs" />
4647
<Compile Include="Common\CollectionObjects.cs" />
4748
<Compile Include="Common\MockObject.cs" />
@@ -56,6 +57,7 @@
5657
<Compile Include="RemoteProgram\RemoteAppProgram.cs" />
5758
<Compile Include="SecurityPrincipals\RemoteAppSecurityPrincipals.cs" />
5859
<Compile Include="Templates\RemoteAppTemplates.cs" />
60+
<Compile Include="UserDisk\RemoteAppUserDisk.cs" />
5961
<Compile Include="Vm\RemoteAppVm.cs" />
6062
<Compile Include="VNet\RemoteAppVNet.cs" />
6163
<Compile Include="Workspace\RemoteAppWorkspace.cs" />
@@ -143,11 +145,12 @@
143145
<SpecificVersion>False</SpecificVersion>
144146
<HintPath>..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll</HintPath>
145147
</Reference>
148+
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
146149
<Reference Include="Microsoft.WindowsAzure.Management">
147150
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.4.1.1\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
148151
</Reference>
149152
<Reference Include="Microsoft.WindowsAzure.Management.RemoteApp, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
150-
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.RemoteApp.2.0.4\lib\net40\Microsoft.WindowsAzure.Management.RemoteApp.dll</HintPath>
153+
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.RemoteApp.2.0.6\lib\net40\Microsoft.WindowsAzure.Management.RemoteApp.dll</HintPath>
151154
</Reference>
152155
<Reference Include="Moq, Version=4.2.1510.2205, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
153156
<HintPath>..\..\..\packages\Moq.4.2.1510.2205\lib\net40\Moq.dll</HintPath>
@@ -171,8 +174,10 @@
171174
<HintPath>..\..\..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Primitives.dll</HintPath>
172175
</Reference>
173176
<Reference Include="System.Net.Http.WebRequest" />
174-
<Reference Include="System.Xml" /> <Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
175-
<HintPath>..\..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath> <Private>True</Private>
177+
<Reference Include="System.Xml" />
178+
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
179+
<HintPath>..\..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
180+
<Private>True</Private>
176181
</Reference>
177182
<Reference Include="xunit.assert, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
178183
<HintPath>..\..\..\packages\xunit.assert.2.1.0\lib\portable-net45+win8+wp8+wpa81\xunit.assert.dll</HintPath>

src/ServiceManagement/RemoteApp/Commands.RemoteApp.Test/Common/RemoteAppClient.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ public abstract class RemoteAppClientTest : SMTestBase
4444

4545
protected const string collectionName = "test1";
4646

47+
protected const string secondaryCollectionName = "test2";
48+
49+
protected const bool OverwriteExistingUserDisk = false;
50+
4751
protected const string vmName = "testVm";
4852

4953
protected const string loggedInUserUpn = "[email protected]";

0 commit comments

Comments
 (0)