Skip to content

Commit b0c0000

Browse files
authored
Update most of the tests to use snapshots (#9121)
- Got newer ones, and handled multifile
1 parent a45dd01 commit b0c0000

File tree

170 files changed

+3856
-3974
lines changed

Some content is hidden

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

170 files changed

+3856
-3974
lines changed

tests/Aspire.Hosting.Azure.Tests/AzureAppServiceTests.cs

Lines changed: 12 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -47,28 +47,9 @@ public async Task AddContainerAppEnvironmentAddsDeploymentTargetWithContainerApp
4747

4848
var (manifest, bicep) = await GetManifestWithBicep(resource);
4949

50-
var m = manifest.ToString();
51-
52-
var expectedManifest =
53-
"""
54-
{
55-
"type": "azure.bicep.v0",
56-
"path": "api.module.bicep",
57-
"params": {
58-
"env_outputs_azure_container_registry_endpoint": "{env.outputs.AZURE_CONTAINER_REGISTRY_ENDPOINT}",
59-
"env_outputs_planid": "{env.outputs.planId}",
60-
"env_outputs_azure_container_registry_managed_identity_id": "{env.outputs.AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID}",
61-
"env_outputs_azure_container_registry_managed_identity_client_id": "{env.outputs.AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_CLIENT_ID}",
62-
"api_containerimage": "{api.containerImage}",
63-
"api_containerport": "{api.containerPort}"
64-
}
65-
}
66-
""";
67-
68-
Assert.Equal(expectedManifest, m);
69-
70-
await Verifier.Verify(bicep, extension: "bicep")
71-
.UseHelixAwareDirectory("Snapshots");
50+
await Verify(manifest.ToString(), "json")
51+
.AppendContentAsFile(bicep, "bicep")
52+
.UseHelixAwareDirectory();
7253
}
7354

7455
[Fact]
@@ -88,23 +69,9 @@ public async Task AddContainerAppEnvironmentAddsEnvironmentResource()
8869

8970
var (manifest, bicep) = await GetManifestWithBicep(environment);
9071

91-
var m = manifest.ToString();
92-
93-
var expectedManifest =
94-
"""
95-
{
96-
"type": "azure.bicep.v0",
97-
"path": "env.module.bicep",
98-
"params": {
99-
"userPrincipalId": ""
100-
}
101-
}
102-
""";
103-
104-
Assert.Equal(expectedManifest, m);
105-
106-
await Verifier.Verify(bicep, extension: "bicep")
107-
.UseHelixAwareDirectory("Snapshots");
72+
await Verify(manifest.ToString(), "json")
73+
.AppendContentAsFile(bicep, "bicep")
74+
.UseHelixAwareDirectory();
10875
}
10976

11077
[Fact]
@@ -136,30 +103,9 @@ public async Task KeyvaultReferenceHandling()
136103

137104
var (manifest, bicep) = await GetManifestWithBicep(resource);
138105

139-
var m = manifest.ToString();
140-
141-
var expectedManifest =
142-
"""
143-
{
144-
"type": "azure.bicep.v0",
145-
"path": "api.module.bicep",
146-
"params": {
147-
"env_outputs_azure_container_registry_endpoint": "{env.outputs.AZURE_CONTAINER_REGISTRY_ENDPOINT}",
148-
"env_outputs_planid": "{env.outputs.planId}",
149-
"env_outputs_azure_container_registry_managed_identity_id": "{env.outputs.AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID}",
150-
"env_outputs_azure_container_registry_managed_identity_client_id": "{env.outputs.AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_CLIENT_ID}",
151-
"api_containerimage": "{api.containerImage}",
152-
"mydb_kv_outputs_name": "{mydb-kv.outputs.name}",
153-
"api_identity_outputs_id": "{api-identity.outputs.id}",
154-
"api_identity_outputs_clientid": "{api-identity.outputs.clientId}"
155-
}
156-
}
157-
""";
158-
159-
Assert.Equal(expectedManifest, m);
160-
161-
await Verifier.Verify(bicep, extension: "bicep")
162-
.UseHelixAwareDirectory("Snapshots");
106+
await Verify(manifest.ToString(), "json")
107+
.AppendContentAsFile(bicep, "bicep")
108+
.UseHelixAwareDirectory();
163109
}
164110

165111
[Fact]
@@ -193,28 +139,9 @@ public async Task EndpointReferencesAreResolvedAcrossProjects()
193139

194140
var (manifest, bicep) = await GetManifestWithBicep(resource);
195141

196-
var m = manifest.ToString();
197-
198-
var expectedManifest =
199-
"""
200-
{
201-
"type": "azure.bicep.v0",
202-
"path": "project2.module.bicep",
203-
"params": {
204-
"env_outputs_azure_container_registry_endpoint": "{env.outputs.AZURE_CONTAINER_REGISTRY_ENDPOINT}",
205-
"env_outputs_planid": "{env.outputs.planId}",
206-
"env_outputs_azure_container_registry_managed_identity_id": "{env.outputs.AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID}",
207-
"env_outputs_azure_container_registry_managed_identity_client_id": "{env.outputs.AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_CLIENT_ID}",
208-
"project2_containerimage": "{project2.containerImage}",
209-
"project2_containerport": "{project2.containerPort}"
210-
}
211-
}
212-
""";
213-
214-
Assert.Equal(expectedManifest, m);
215-
216-
await Verifier.Verify(bicep, extension: "bicep")
217-
.UseHelixAwareDirectory("Snapshots");
142+
await Verify(manifest.ToString(), "json")
143+
.AppendContentAsFile(bicep, "bicep")
144+
.UseHelixAwareDirectory();
218145
}
219146

220147
private static Task<(JsonNode ManifestNode, string BicepText)> GetManifestWithBicep(IResource resource) =>

0 commit comments

Comments
 (0)