Skip to content

Commit a3fc9e7

Browse files
committed
working on testing and small bug fixes
1 parent 415c284 commit a3fc9e7

File tree

7 files changed

+310
-736
lines changed

7 files changed

+310
-736
lines changed

src/Resources/ResourceManager/SdkClient/DeploymentStacksSdkClient.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public PSDeploymentStackTemplateDefinition ExportResourceGroupDeploymentStack(
100100
{
101101
var deploymentStack = DeploymentStacksClient.DeploymentStacks.ExportTemplateAtResourceGroup(resourceGroupName, deploymentStackName);
102102

103-
return new PSDeploymentStackTemplateDefinition(deploymentStack.Template.ToString(), deploymentStack.TemplateLink);
103+
return new PSDeploymentStackTemplateDefinition(deploymentStack.Template, deploymentStack.TemplateLink);
104104
}
105105
catch (Exception ex)
106106
{
@@ -134,7 +134,7 @@ public PSDeploymentStackTemplateDefinition ExportSubscriptionDeploymentStack(
134134
{
135135
var deploymentStack = DeploymentStacksClient.DeploymentStacks.ExportTemplateAtSubscription(deploymentStackName);
136136

137-
return new PSDeploymentStackTemplateDefinition(deploymentStack.Template.ToString(), deploymentStack.TemplateLink);
137+
return new PSDeploymentStackTemplateDefinition(deploymentStack.Template, deploymentStack.TemplateLink);
138138
}
139139
catch (Exception ex)
140140
{
@@ -169,7 +169,7 @@ public PSDeploymentStackTemplateDefinition ExportManagementGroupDeploymentStack(
169169
{
170170
var deploymentStack = DeploymentStacksClient.DeploymentStacks.ExportTemplateAtManagementGroup(managementGroupId, deploymentStackName);
171171

172-
return new PSDeploymentStackTemplateDefinition(deploymentStack.Template.ToString(), deploymentStack.TemplateLink);
172+
return new PSDeploymentStackTemplateDefinition(deploymentStack.Template, deploymentStack.TemplateLink);
173173
}
174174
catch (Exception ex)
175175
{

src/Resources/ResourceManager/SdkModels/DeploymentStacks/PSDeploymentStackTemplateDefinition.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@ public class PSDeploymentStackTemplateDefinition
66
{
77
public string Template { get; set; }
88

9+
//public PSDeploymentStackTemplateLink TemplateLink { get; set; }
910
public DeploymentStacksTemplateLink TemplateLink { get; set; }
1011

11-
internal PSDeploymentStackTemplateDefinition(string template, DeploymentStacksTemplateLink link)
12+
internal PSDeploymentStackTemplateDefinition(object template, DeploymentStacksTemplateLink link)
1213
{
13-
Template = template;
14-
TemplateLink = link;
14+
if (template != null)
15+
{
16+
Template = template.ToString();
17+
}
18+
//TemplateLink = new PSDeploymentStackTemplateLink(link);
19+
TemplateLink = link;
1520
}
16-
1721
}
1822
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using Microsoft.Azure.Management.ResourceManager.Models;
2+
using Newtonsoft.Json;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Text;
6+
7+
namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels
8+
{
9+
public class PSDeploymentStackTemplateLink
10+
{
11+
public string Uri { get; set; }
12+
13+
public string Id { get; set; }
14+
15+
public string RelativePath { get; set; }
16+
17+
public string QueryString { get; set; }
18+
19+
public string ContentVersion { get; set; }
20+
21+
internal PSDeploymentStackTemplateLink(DeploymentStacksTemplateLink link)
22+
{
23+
link.Uri = Uri;
24+
link.Id = Id;
25+
link.RelativePath = RelativePath;
26+
link.QueryString = QueryString;
27+
link.ContentVersion = ContentVersion;
28+
}
29+
}
30+
}

src/Resources/Resources.Test/ScenarioTests/DeploymentStackTests.cs

Lines changed: 49 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ public void TestSetResourceGroupDeploymentStackDenySettings()
7575

7676
[Fact()]
7777
[Trait(Category.AcceptanceType, Category.CheckIn)]
78-
public void TestNewAndSetResourceGroupDeploymentStackWithTemplateSpec()
78+
public void TestNewAndSetAndExportResourceGroupDeploymentStackWithTemplateSpec()
7979
{
80-
TestRunner.RunTestScript("Test-NewAndSetResourceGroupDeploymentStackWithTemplateSpec");
80+
TestRunner.RunTestScript("Test-NewAndSetAndExportResourceGroupDeploymentStackWithTemplateSpec");
8181
}
8282

8383
[Fact()]
@@ -101,32 +101,53 @@ public void TestRemoveResourceGroupDeploymentStack()
101101
TestRunner.RunTestScript("Test-RemoveResourceGroupDeploymentStack");
102102
}
103103

104-
/* [Fact()]
104+
[Fact()]
105+
[Trait(Category.AcceptanceType, Category.CheckIn)]
106+
public void TestGetSubscriptionDeploymentStack()
107+
{
108+
TestRunner.RunTestScript("Test-GetSubscriptionDeploymentStack");
109+
}
110+
111+
[Fact()]
112+
[Trait(Category.AcceptanceType, Category.CheckIn)]
113+
public void TestNewSubscriptionDeploymentStack()
114+
{
115+
TestRunner.RunTestScript("Test-NewSubscriptionDeploymentStack");
116+
}
117+
118+
[Fact()]
105119
[Trait(Category.AcceptanceType, Category.CheckIn)]
106120
public void TestNewSubscriptionDeploymentStackUnmanageActions()
107121
{
108122
TestRunner.RunTestScript("Test-NewSubscriptionDeploymentStackUnmanageActions");
109123
}
110124

125+
[Fact()]
126+
[Trait(Category.AcceptanceType, Category.CheckIn)]
127+
public void TestNewSubscriptionDeploymentStackDenySettings()
128+
{
129+
TestRunner.RunTestScript("Test-NewSubscriptionDeploymentStackDenySettings");
130+
}
131+
111132
[Fact()]
112133
[Trait(Category.AcceptanceType, Category.CheckIn)]
113134
public void TestSetSubscriptionDeploymentStack()
114135
{
115-
TestRunner.RunTestScript("Test-SetSubscriptionDeploymentStack");
136+
TestRunner.RunTestScript("Test-NewSubscriptionDeploymentStack");
116137
}
117138

118139
[Fact()]
119140
[Trait(Category.AcceptanceType, Category.CheckIn)]
120141
public void TestSetSubscriptionDeploymentStackUnmanageActions()
121142
{
122-
TestRunner.RunTestScript("Test-SetSubscriptionDeploymentStackUnmanageActions");
143+
TestRunner.RunTestScript("Test-NewSubscriptionDeploymentStackUnmanageActions");
123144
}
124145

125146
[Fact()]
126147
[Trait(Category.AcceptanceType, Category.CheckIn)]
127-
public void TestNewAndSetSubscriptionDeploymentStackWithBicep()
148+
public void TestSetSubscriptionDeploymentStackDenySettings()
128149
{
129-
TestRunner.RunTestScript("Test-NewAndSetSubscriptionDeploymentStackWithBicep");
150+
TestRunner.RunTestScript("Test-SetSubscriptionDeploymentStackDenySettings");
130151
}
131152

132153
[Fact()]
@@ -135,27 +156,26 @@ public void TestNewAndSetSubscriptionDeploymentStackWithTemplateSpec()
135156
{
136157
TestRunner.RunTestScript("Test-NewAndSetSubscriptionDeploymentStackWithTemplateSpec");
137158
}
138-
*/
139-
140-
/* [Fact()]
141-
[Trait(Category.AcceptanceType, Category.CheckIn)]
142-
public void TestResourceGroupDeploymentStackSnapshotDelete()
143-
{
144-
TestRunner.RunTestScript("Test-RemoveResourceGroupDeploymentStackSnapshot");
145-
}*/
146-
147-
/* [Fact()]
148-
[Trait(Category.AcceptanceType, Category.CheckIn)]
149-
public void TestSubscriptionDeploymentStackDelete()
150-
{
151-
TestRunner.RunTestScript("Test-RemoveSubscriptionDeploymentStack");
152-
}*/
153-
154-
/* [Fact()]
155-
[Trait(Category.AcceptanceType, Category.CheckIn)]
156-
public void TestSubscriptionDeploymentStackSnapshotDelete()
157-
{
158-
TestRunner.RunTestScript("Test-RemoveSubscriptionDeploymentStackSnapshot");
159-
}*/
159+
160+
[Fact()]
161+
[Trait(Category.AcceptanceType, Category.CheckIn)]
162+
public void TestNewAndSetSubscriptionDeploymentStackWithBicep()
163+
{
164+
TestRunner.RunTestScript("Test-NewAndSetSubscriptionDeploymentStackWithBicep");
165+
}
166+
167+
[Fact()]
168+
[Trait(Category.AcceptanceType, Category.CheckIn)]
169+
public void TestExportSubscriptionDeploymentStackTemplate()
170+
{
171+
TestRunner.RunTestScript("Test-ExportSubscriptionDeploymentStackTemplate");
172+
}
173+
174+
[Fact()]
175+
[Trait(Category.AcceptanceType, Category.CheckIn)]
176+
public void TestRemoveSubscriptionDeploymentStack()
177+
{
178+
TestRunner.RunTestScript("Test-RemoveSubscriptionDeploymentStack");
179+
}
160180
}
161181
}

0 commit comments

Comments
 (0)