Skip to content

Commit

Permalink
Do not use underscores in the ApplicationId
Browse files Browse the repository at this point in the history
Underscores are not supported on Windows
  • Loading branch information
mattleibow authored Dec 12, 2023
1 parent 3c7b652 commit f501d24
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 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,33 @@ 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 = TestDirectory;
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);

var doc = XDocument.Load(docPath);
var appId = doc.Root.Elements("PropertyGroup").Element("ApplicationId").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

0 comments on commit f501d24

Please sign in to comment.