Skip to content

Commit 31a45a2

Browse files
committed
added an endtoend test for Set-AzureRmContext
1 parent e7d7339 commit 31a45a2

File tree

6 files changed

+361
-106
lines changed

6 files changed

+361
-106
lines changed

src/ResourceManager/Profile/Commands.Profile.Test/Commands.Profile.Test.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@
193193
</Content>
194194
<None Include="MSSharedLibKey.snk" />
195195
<None Include="packages.config" />
196-
<None Include="SessionRecords\Microsoft.Azure.Commands.Profile.Test.SubscriptionCmdletTests\AllParameterSetsSucceed.json">
196+
<None Include="SessionRecords\Microsoft.Azure.Commands.Profile.Test.SubscriptionCmdletTests\AllParameterSetsSucceed.json" />
197+
<None Include="SessionRecords\Microsoft.Azure.Commands.Profile.Test.SubscriptionCmdletTests\SetAzureRmContextWorks.json">
197198
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
198199
</None>
199200
</ItemGroup>

src/ResourceManager/Profile/Commands.Profile.Test/ContextCmdletTests.cs

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -59,48 +59,6 @@ public void GetAzureContext()
5959
Assert.Equal("test", context.Subscription.SubscriptionName);
6060
}
6161

62-
[Fact]
63-
[Trait(Category.AcceptanceType, Category.CheckIn)]
64-
public void SelectAzureContextWithSubscriptionAndTenant()
65-
{
66-
var cmdlt = new SetAzureRMContextCommand();
67-
// Setup
68-
cmdlt.CommandRuntime = commandRuntimeMock;
69-
cmdlt.SubscriptionId = "db1ab6f0-4769-4b27-930e-01e2ef9c123c";
70-
cmdlt.TenantId = "72f988bf-86f1-41af-91ab-2d7cd011db47";
71-
72-
// Act
73-
cmdlt.InvokeBeginProcessing();
74-
cmdlt.ExecuteCmdlet();
75-
cmdlt.InvokeEndProcessing();
76-
77-
// Verify
78-
Assert.True(commandRuntimeMock.OutputPipeline.Count == 1);
79-
var context = (PSAzureContext)commandRuntimeMock.OutputPipeline[0];
80-
Assert.Equal("db1ab6f0-4769-4b27-930e-01e2ef9c123c", context.Subscription.SubscriptionId);
81-
Assert.Equal("72f988bf-86f1-41af-91ab-2d7cd011db47", context.Tenant.TenantId);
82-
}
83-
84-
[Fact]
85-
[Trait(Category.AcceptanceType, Category.CheckIn)]
86-
public void SelectAzureContextWithSubscriptionAndNoTenant()
87-
{
88-
var cmdlt = new SetAzureRMContextCommand();
89-
// Setup
90-
cmdlt.CommandRuntime = commandRuntimeMock;
91-
cmdlt.SubscriptionId = "db1ab6f0-4769-4b27-930e-01e2ef9c123c";
92-
93-
// Act
94-
cmdlt.InvokeBeginProcessing();
95-
cmdlt.ExecuteCmdlet();
96-
cmdlt.InvokeEndProcessing();
97-
98-
// Verify
99-
Assert.True(commandRuntimeMock.OutputPipeline.Count == 1);
100-
var context = (PSAzureContext)commandRuntimeMock.OutputPipeline[0];
101-
Assert.Equal("db1ab6f0-4769-4b27-930e-01e2ef9c123c", context.Subscription.SubscriptionId);
102-
}
103-
10462
[Fact]
10563
[Trait(Category.AcceptanceType, Category.CheckIn)]
10664
public void SelectAzureContextWithNoSubscriptionAndTenant()

0 commit comments

Comments
 (0)