Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mattleibow committed Jul 31, 2024
1 parent 4566b02 commit df3e1d6
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ public class BaseBuildTest
public const string DotNetCurrent = "net9.0";
public const string DotNetPrevious = "net8.0";

public const string MauiVersionCurrent = "8.0.0-rc.2.9530"; // this should not be the same as the last release
public const string MauiVersionPrevious = "8.0.1"; // this should not be the same version as the default. aka: MicrosoftMauiPreviousDotNetReleasedVersion in eng/Versions.props
public const string MauiVersionNext = "9.0.0-preview.7.*"; // this should not be the version that we are building
public const string MauiVersionCurrent = "9.0.0-preview.6.24327.7"; // this should not be the same as the last release
public const string MauiVersionPrevious = "8.0.60"; // this should not be the same version as the default. aka: MicrosoftMauiPreviousDotNetReleasedVersion in eng/Versions.props

char[] invalidChars = { '{', '}', '(', ')', '$', ':', ';', '\"', '\'', ',', '=', '.', '-', ' ', };

Expand Down
56 changes: 44 additions & 12 deletions src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ public void TemplateTestsSetUp()

[Test]
// Parameters: short name, target framework, build config, use pack target, additionalDotNetNewParams
//[TestCase("maui", DotNetPrevious, "Debug", false, "")]
//[TestCase("maui", DotNetPrevious, "Release", false, "")]
[TestCase("maui", DotNetPrevious, "Debug", false, "")]
[TestCase("maui", DotNetPrevious, "Release", false, "")]
[TestCase("maui", DotNetCurrent, "Debug", false, "")]
[TestCase("maui", DotNetCurrent, "Release", false, "")]
//[TestCase("maui-blazor", DotNetPrevious, "Debug", false, "")]
//[TestCase("maui-blazor", DotNetPrevious, "Release", false, "")]
[TestCase("maui-blazor", DotNetPrevious, "Debug", false, "")]
[TestCase("maui-blazor", DotNetPrevious, "Release", false, "")]
[TestCase("maui-blazor", DotNetCurrent, "Debug", false, "")]
[TestCase("maui-blazor", DotNetCurrent, "Release", false, "")]
[TestCase("maui-blazor", DotNetCurrent, "Debug", false, "--Empty")]
Expand Down Expand Up @@ -217,12 +217,12 @@ public void BuildsWithSpecialCharacters(string id, string projectName, string ex

[Test]
// Parameters: short name, target framework, build config, use pack target
//[TestCase("maui", DotNetPrevious, "Debug", false)]
//[TestCase("maui", DotNetPrevious, "Release", false)]
[TestCase("maui", DotNetPrevious, "Debug", false)]
[TestCase("maui", DotNetPrevious, "Release", false)]
[TestCase("maui", DotNetCurrent, "Debug", false)]
[TestCase("maui", DotNetCurrent, "Release", false)]
//[TestCase("maui-blazor", DotNetPrevious, "Debug", false)]
//[TestCase("maui-blazor", DotNetPrevious, "Release", false)]
[TestCase("maui-blazor", DotNetPrevious, "Debug", false)]
[TestCase("maui-blazor", DotNetPrevious, "Release", false)]
[TestCase("maui-blazor", DotNetCurrent, "Debug", false)]
[TestCase("maui-blazor", DotNetCurrent, "Release", false)]
[TestCase("mauilib", DotNetPrevious, "Debug", true)]
Expand All @@ -239,6 +239,38 @@ public void BuildWithMauiVersion(string id, string framework, string config, boo

EnableTizen(projectFile);

if (shouldPack)
FileUtilities.ReplaceInFile(projectFile,
"</Project>",
"<PropertyGroup><Version>1.0.0-preview.1</Version></PropertyGroup></Project>");

// set <MauiVersion> in the csproj as that is the reccommended place
FileUtilities.ReplaceInFile(projectFile,
"</Project>",
$"<PropertyGroup><MauiVersion>{MauiVersionNext}</MauiVersion></PropertyGroup></Project>");

string target = shouldPack ? "Pack" : "";
Assert.IsTrue(DotnetInternal.Build(projectFile, config, target: target, properties: BuildProps),
$"Project {Path.GetFileName(projectFile)} failed to build. Check test output/attachments for errors.");
}

[Test]
[TestCase("maui", "Debug", false)]
[TestCase("maui", "Release", false)]
[TestCase("maui-blazor", "Debug", false)]
[TestCase("maui-blazor", "Release", false)]
[TestCase("mauilib", "Debug", true)]
[TestCase("mauilib", "Release", true)]
public void PreviousDotNetCanUseLatestMaui(string id, string config, bool shouldPack)
{
var projectDir = TestDirectory;
var projectFile = Path.Combine(projectDir, $"{Path.GetFileName(projectDir)}.csproj");

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

EnableTizen(projectFile);

if (shouldPack)
FileUtilities.ReplaceInFile(projectFile,
"</Project>",
Expand All @@ -256,12 +288,12 @@ public void BuildWithMauiVersion(string id, string framework, string config, boo
}

[Test]
//[TestCase("maui", DotNetPrevious, "Debug")]
//[TestCase("maui", DotNetPrevious, "Release")]
[TestCase("maui", DotNetPrevious, "Debug")]
[TestCase("maui", DotNetPrevious, "Release")]
[TestCase("maui", DotNetCurrent, "Debug")]
[TestCase("maui", DotNetCurrent, "Release")]
//[TestCase("maui-blazor", DotNetPrevious, "Debug")]
//[TestCase("maui-blazor", DotNetPrevious, "Release")]
[TestCase("maui-blazor", DotNetPrevious, "Debug")]
[TestCase("maui-blazor", DotNetPrevious, "Release")]
[TestCase("maui-blazor", DotNetCurrent, "Debug")]
[TestCase("maui-blazor", DotNetCurrent, "Release")]
public void BuildUnpackaged(string id, string framework, string config)
Expand Down

0 comments on commit df3e1d6

Please sign in to comment.