Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"steps": [
{
"regex": "[^a-z0-9_\\.]",
"replacement": "_"
"replacement": ""
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"steps": [
{
"regex": "[^a-z0-9_\\.]",
"replacement": "_"
"replacement": ""
}
]
}
Expand Down
36 changes: 36 additions & 0 deletions src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Xml.Linq;
using Microsoft.Maui.IntegrationTests.Apple;

namespace Microsoft.Maui.IntegrationTests
Expand Down Expand Up @@ -47,6 +48,41 @@ public void Build(string id, string framework, string config, bool shouldPack)
$"Project {Path.GetFileName(projectFile)} failed to build. Check test output/attachments for errors.");
}

[Test]
// with spaces
[TestCase("maui", "Project Space", "projectspace")]
[TestCase("maui-blazor", "Project Space", "projectspace")]
[TestCase("mauilib", "Project Space", "projectspace")]
// with invalid characters
[TestCase("maui", "Project@Symbol", "projectsymbol")]
[TestCase("maui-blazor", "Project@Symbol", "projectsymbol")]
[TestCase("mauilib", "Project@Symbol", "projectsymbol")]
public void BuildsWithSpecialCharacters(string id, string projectName, string expectedId)
{
var projectDir = Path.Combine(TestDirectory, projectName);
var projectFile = Path.Combine(projectDir, $"{projectName}.csproj");

Assert.IsTrue(DotnetInternal.New(id, projectDir, DotNetCurrent),
$"Unable to create template {id}. Check test output for errors.");

EnableTizen(projectFile);

// libraries do not have application IDs
if (id != "mauilib")
{
var doc = XDocument.Load(projectFile);
var appId = doc.Root!
.Elements("PropertyGroup")
.Elements("ApplicationId")
.Single()
.Value;
Assert.AreEqual($"com.companyname.{expectedId}", appId);
}

Assert.IsTrue(DotnetInternal.Build(projectFile, "Debug", properties: BuildProps, msbuildWarningsAsErrors: true),
$"Project {Path.GetFileName(projectFile)} failed to build. Check test output/attachments for errors.");
}

[Test]
// Parameters: short name, target framework, build config, use pack target
[TestCase("maui", DotNetPrevious, "Debug", false)]
Expand Down