Skip to content

Centralize Verify convention #9371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions tests/Aspire.Hosting.Azure.Tests/AzureAppServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ public async Task AddContainerAppEnvironmentAddsDeploymentTargetWithContainerApp
var (manifest, bicep) = await GetManifestWithBicep(resource);

await Verify(manifest.ToString(), "json")
.AppendContentAsFile(bicep, "bicep")
.UseHelixAwareDirectory();
.AppendContentAsFile(bicep, "bicep");
}

[Fact]
Expand All @@ -70,8 +69,7 @@ public async Task AddContainerAppEnvironmentAddsEnvironmentResource()
var (manifest, bicep) = await GetManifestWithBicep(environment);

await Verify(manifest.ToString(), "json")
.AppendContentAsFile(bicep, "bicep")
.UseHelixAwareDirectory();
.AppendContentAsFile(bicep, "bicep");
}

[Fact]
Expand Down Expand Up @@ -104,8 +102,7 @@ public async Task KeyvaultReferenceHandling()
var (manifest, bicep) = await GetManifestWithBicep(resource);

await Verify(manifest.ToString(), "json")
.AppendContentAsFile(bicep, "bicep")
.UseHelixAwareDirectory();
.AppendContentAsFile(bicep, "bicep");
}

[Fact]
Expand Down Expand Up @@ -140,8 +137,7 @@ public async Task EndpointReferencesAreResolvedAcrossProjects()
var (manifest, bicep) = await GetManifestWithBicep(resource);

await Verify(manifest.ToString(), "json")
.AppendContentAsFile(bicep, "bicep")
.UseHelixAwareDirectory();
.AppendContentAsFile(bicep, "bicep");
}

[Fact]
Expand Down
69 changes: 23 additions & 46 deletions tests/Aspire.Hosting.Azure.Tests/AzureBicepResourceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,7 @@ public async Task AddAzureCosmosDBViaRunMode_WithAccessKeyAuthentication(string?

Assert.Equal(expectedManifest, manifest.ManifestNode.ToString());

await Verifier.Verify(manifest.BicepText, extension: "bicep")
.UseHelixAwareDirectory("Snapshots");
await Verify(manifest.BicepText, extension: "bicep");

Assert.NotNull(callbackDatabases);
Assert.Collection(
Expand Down Expand Up @@ -368,8 +367,7 @@ public async Task AddAzureCosmosDBViaRunMode_NoAccessKeyAuthentication()
output.WriteLine(manifest.ManifestNode.ToString());
Assert.Equal(expectedManifest, manifest.ManifestNode.ToString());

await Verifier.Verify(manifest.BicepText, extension: "bicep")
.UseHelixAwareDirectory("Snapshots");
await Verify(manifest.BicepText, extension: "bicep");

Assert.NotNull(callbackDatabases);
Assert.Collection(
Expand Down Expand Up @@ -445,8 +443,7 @@ public async Task AddAzureCosmosDBViaPublishMode_WithAccessKeyAuthentication(str
output.WriteLine(m);
Assert.Equal(expectedManifest, m);

await Verifier.Verify(manifest.BicepText, extension: "bicep")
.UseHelixAwareDirectory("Snapshots");
await Verify(manifest.BicepText, extension: "bicep");

Assert.NotNull(callbackDatabases);
Assert.Collection(
Expand Down Expand Up @@ -487,8 +484,7 @@ public async Task AddAzureCosmosDBViaPublishMode_NoAccessKeyAuthentication()
""";
Assert.Equal(expectedManifest, manifest.ManifestNode.ToString());

await Verifier.Verify(manifest.BicepText, extension: "bicep")
.UseHelixAwareDirectory("Snapshots");
await Verify(manifest.BicepText, extension: "bicep");

Assert.NotNull(callbackDatabases);
Assert.Collection(
Expand Down Expand Up @@ -611,8 +607,7 @@ public async Task AddApplicationInsightsWithoutExplicitLawGetsDefaultLawParamete
""";
Assert.Equal(expectedManifest, appInsightsManifest.ManifestNode.ToString());

await Verifier.Verify(appInsightsManifest.BicepText, extension: "bicep")
.UseHelixAwareDirectory("Snapshots");
await Verify(appInsightsManifest.BicepText, extension: "bicep");
}

[Fact]
Expand Down Expand Up @@ -640,8 +635,7 @@ public async Task AddApplicationInsightsWithoutExplicitLawGetsDefaultLawParamete
""";
Assert.Equal(expectedManifest, appInsightsManifest.ManifestNode.ToString());

await Verifier.Verify(appInsightsManifest.BicepText, extension: "bicep")
.UseHelixAwareDirectory("Snapshots");
await Verify(appInsightsManifest.BicepText, extension: "bicep");
}

[Fact]
Expand Down Expand Up @@ -673,8 +667,7 @@ public async Task AddApplicationInsightsWithExplicitLawArgumentDoesntGetDefaultP
""";
Assert.Equal(expectedManifest, appInsightsManifest.ManifestNode.ToString());

await Verifier.Verify(appInsightsManifest.BicepText, extension: "bicep")
.UseHelixAwareDirectory("Snapshots");
await Verify(appInsightsManifest.BicepText, extension: "bicep");
}

[Fact]
Expand All @@ -696,8 +689,7 @@ public async Task AddLogAnalyticsWorkspace()
""";
Assert.Equal(expectedManifest, appInsightsManifest.ManifestNode.ToString());

await Verifier.Verify(appInsightsManifest.BicepText, extension: "bicep")
.UseHelixAwareDirectory("Snapshots");
await Verify(appInsightsManifest.BicepText, extension: "bicep");
}

[Fact]
Expand Down Expand Up @@ -846,8 +838,7 @@ public async Task PublishAsRedisPublishesRedisAsAzureRedisInfrastructure()
""";
Assert.Equal(expectedManifest, manifest.ManifestNode.ToString());

await Verifier.Verify(manifest.BicepText, extension: "bicep")
.UseHelixAwareDirectory("Snapshots");
await Verify(manifest.BicepText, extension: "bicep");
}

[Fact]
Expand Down Expand Up @@ -878,8 +869,7 @@ public async Task AsAzureSqlDatabaseViaRunMode()
""";
Assert.Equal(expectedManifest, manifest.ManifestNode.ToString());

await Verifier.Verify(manifest.BicepText, extension: "bicep")
.UseHelixAwareDirectory("Snapshots");
await Verify(manifest.BicepText, extension: "bicep");
}

[Fact]
Expand Down Expand Up @@ -910,8 +900,7 @@ public async Task AsAzureSqlDatabaseViaPublishMode()
""";
Assert.Equal(expectedManifest, manifest.ManifestNode.ToString());

await Verifier.Verify(manifest.BicepText, extension: "bicep")
.UseHelixAwareDirectory("Snapshots");
await Verify(manifest.BicepText, extension: "bicep");
}

[Fact]
Expand Down Expand Up @@ -954,8 +943,7 @@ public async Task AsAzurePostgresFlexibleServerViaRunMode()
""";
Assert.Equal(expectedManifest, manifest.ManifestNode.ToString());

await Verifier.Verify(manifest.BicepText, extension: "bicep")
.UseHelixAwareDirectory("Snapshots");
await Verify(manifest.BicepText, extension: "bicep");
}

[Fact]
Expand Down Expand Up @@ -998,8 +986,7 @@ public async Task AsAzurePostgresFlexibleServerViaPublishMode()
""";
Assert.Equal(expectedManifest, manifest.ManifestNode.ToString());

await Verifier.Verify(manifest.BicepText, extension: "bicep")
.UseHelixAwareDirectory("Snapshots");
await Verify(manifest.BicepText, extension: "bicep");
}

[Fact]
Expand Down Expand Up @@ -1154,8 +1141,7 @@ public async Task AddAzureServiceBus(bool useObsoleteMethods)
""";
Assert.Equal(expected, manifest.ManifestNode.ToString());

await Verifier.Verify(manifest.BicepText, extension: "bicep")
.UseHelixAwareDirectory("Snapshots");
await Verify(manifest.BicepText, extension: "bicep");

var sbRoles = Assert.Single(model.Resources.OfType<AzureProvisioningResource>(), r => r.Name == "sb-roles");
var sbRolesManifest = await GetManifestWithBicep(sbRoles, skipPreparer: true);
Expand Down Expand Up @@ -1215,8 +1201,7 @@ public async Task AddDefaultAzureWebPubSub()

Assert.Equal("wps1", wps.Resource.Name);
output.WriteLine(manifest.BicepText);
await Verifier.Verify(manifest.BicepText, extension: "bicep")
.UseHelixAwareDirectory("Snapshots");
await Verify(manifest.BicepText, extension: "bicep");

var wpsRoles = Assert.Single(model.Resources.OfType<AzureProvisioningResource>(), r => r.Name == "wps1-roles");
var wpsRolesManifest = await GetManifestWithBicep(wpsRoles, skipPreparer: true);
Expand Down Expand Up @@ -1274,8 +1259,7 @@ public async Task AddAzureWebPubSubWithParameters()

Assert.Equal("wps1", wps.Resource.Name);

await Verifier.Verify(manifest.BicepText, extension: "bicep")
.UseHelixAwareDirectory("Snapshots");
await Verify(manifest.BicepText, extension: "bicep");
}

[Fact]
Expand Down Expand Up @@ -1352,8 +1336,7 @@ public async Task AddAzureStorageViaRunMode()
""";
Assert.Equal(expectedStorageManifest, storageManifest.ManifestNode.ToString());

await Verifier.Verify(storageManifest.BicepText, extension: "bicep")
.UseHelixAwareDirectory("Snapshots");
await Verify(storageManifest.BicepText, extension: "bicep");

// Check blob resource.
var blob = storage.AddBlobs("blob");
Expand Down Expand Up @@ -1438,8 +1421,7 @@ public async Task AddAzureStorageViaRunModeAllowSharedKeyAccessOverridesDefaultF
""";
Assert.Equal(expectedStorageManifest, storageManifest.ManifestNode.ToString());

await Verifier.Verify(storageManifest.BicepText, extension: "bicep")
.UseHelixAwareDirectory("Snapshots");
await Verify(storageManifest.BicepText, extension: "bicep");

// Check blob resource.
var blob = storage.AddBlobs("blob");
Expand Down Expand Up @@ -1529,8 +1511,7 @@ public async Task AddAzureStorageViaPublishMode()
""";
Assert.Equal(expectedStorageManifest, storageManifest.ManifestNode.ToString());

await Verifier.Verify(storageManifest.BicepText, extension: "bicep")
.UseHelixAwareDirectory("Snapshots");
await Verify(storageManifest.BicepText, extension: "bicep");

var storageRoles = Assert.Single(model.Resources.OfType<AzureProvisioningResource>(), r => r.Name == "storage-roles");
var storageRolesManifest = await GetManifestWithBicep(storageRoles, skipPreparer: true);
Expand Down Expand Up @@ -1660,8 +1641,7 @@ public async Task AddAzureStorageViaPublishModeEnableAllowSharedKeyAccessOverrid

Assert.Equal(expectedStorageManifest, storageManifest.ManifestNode.ToString());

await Verifier.Verify(storageManifest.BicepText, extension: "bicep")
.UseHelixAwareDirectory("Snapshots");
await Verify(storageManifest.BicepText, extension: "bicep");

// Check blob resource.
var blob = storage.AddBlobs("blob");
Expand Down Expand Up @@ -1752,8 +1732,7 @@ public async Task AddAzureSearch()
""";
Assert.Equal(expectedManifest, manifest.ManifestNode.ToString());

await Verifier.Verify(manifest.BicepText, extension: "bicep")
.UseHelixAwareDirectory("Snapshots");
await Verify(manifest.BicepText, extension: "bicep");

var searchRoles = Assert.Single(model.Resources.OfType<AzureProvisioningResource>(), r => r.Name == "search-roles");
var searchRolesManifest = await GetManifestWithBicep(searchRoles, skipPreparer: true);
Expand Down Expand Up @@ -1884,8 +1863,7 @@ public async Task AddAzureOpenAI(bool overrideLocalAuthDefault, bool useObsolete
""";
Assert.Equal(expectedManifest, manifest.ManifestNode.ToString());

await Verifier.Verify(manifest.BicepText, extension: "bicep")
.UseHelixAwareDirectory("Snapshots");
await Verify(manifest.BicepText, extension: "bicep");

var openaiRoles = Assert.Single(model.Resources.OfType<AzureProvisioningResource>(), r => r.Name == "openai-roles");
var openaiRolesManifest = await GetManifestWithBicep(openaiRoles, skipPreparer: true);
Expand Down Expand Up @@ -1985,8 +1963,7 @@ public async Task InfrastructureCanBeMutatedAfterCreation()
""";
Assert.Equal(expectedManifest, manifest.ToString());

await Verifier.Verify(bicep, extension: "bicep")
.UseHelixAwareDirectory("Snapshots");
await Verify(bicep, extension: "bicep");
}

[UnsafeAccessor(UnsafeAccessorKind.Method, Name = "ExecuteBeforeStartHooksAsync")]
Expand Down
Loading