diff --git a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/AIChatWebExecutionTests.cs b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/AIChatWebExecutionTests.cs
index 44976955975..84c83b0024c 100644
--- a/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/AIChatWebExecutionTests.cs
+++ b/test/ProjectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/AIChatWebExecutionTests.cs
@@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
+using Microsoft.TestUtilities;
using Xunit;
using Xunit.Abstractions;
@@ -71,6 +72,16 @@ public async Task CreateRestoreAndBuild_AspireTemplate(params string[] args)
await Fixture.BuildProjectAsync(project);
}
+ ///
+ /// Runs a single test with --aspire true and a project name that will trigger the class
+ /// name normalization bug reported in https://github.com/dotnet/extensions/issues/6811.
+ ///
+ [Fact]
+ public async Task CreateRestoreAndBuild_AspireProjectName()
+ {
+ await CreateRestoreAndBuild_AspireProjectName_Variants("azureopenai", "mix.ed-dash_name 123");
+ }
+
///
/// Tests build for various project name formats, including dots and other
/// separators, to trigger the class name normalization bug described
@@ -78,9 +89,15 @@ public async Task CreateRestoreAndBuild_AspireTemplate(params string[] args)
/// This runs for all provider combinations with --aspire true and different
/// project names to ensure the bug is caught in all scenarios.
///
- [Theory]
- [MemberData(nameof(GetProjectNameVariants))]
- public async Task CreateRestoreAndBuild_ProjectNameVariants(string provider, string projectName)
+ ///
+ /// Because this test takes a long time to run, it is skipped by default. Set the
+ /// environment variable AI_TEMPLATES_TEST_PROJECT_NAMES to "true" or "1"
+ /// to enable it.
+ ///
+ [ConditionalTheory]
+ [EnvironmentVariableSkipCondition("AI_TEMPLATES_TEST_PROJECT_NAMES", "true", "1")]
+ [MemberData(nameof(GetAspireProjectNameVariants))]
+ public async Task CreateRestoreAndBuild_AspireProjectName_Variants(string provider, string projectName)
{
var project = await Fixture.CreateProjectAsync(
templateName: "aichatweb",
@@ -181,22 +198,22 @@ private static IEnumerable GetAllPossibleOptions(ReadOnlyMemory<(strin
}
}
- public static IEnumerable