Add Aspire.Hosting.Maui.Tests to CI and expand test coverage#14768
Open
jfversluis wants to merge 1 commit intodotnet:mainfrom
Open
Add Aspire.Hosting.Maui.Tests to CI and expand test coverage#14768jfversluis wants to merge 1 commit intodotnet:mainfrom
jfversluis wants to merge 1 commit intodotnet:mainfrom
Conversation
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14768Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 14768" |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enables the Aspire.Hosting.Maui.Tests project in CI and adds comprehensive test coverage (60 new tests) for previously untested MAUI hosting functionality. The tests cover critical areas including input validation, platform-specific arguments, environment variable handling, iOS device/simulator UDID validation, platform support detection, and OTLP configuration.
Changes:
- Added Aspire.Hosting.Maui.Tests to Aspire.slnx to enable CI execution of 72 existing + 60 new unit tests
- Added 60 new tests covering AddMauiProject validation, CLI argument generation per platform, environment helper methods, iOS UDID cross-validation, platform support annotations, and OTLP template resolution
- Changed 4 private methods in MauiEnvironmentHelper to internal for testability (class already internal with InternalsVisibleTo)
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Aspire.slnx | Added Aspire.Hosting.Maui.Tests project to tests/Hosting/ folder in solution to enable CI execution |
| src/Aspire.Hosting.Maui/Utilities/MauiEnvironmentHelper.cs | Changed 4 methods from private to internal for testability: GenerateAndroidTargetsFileContent, GenerateiOSTargetsFileContent, EncodeSemicolons, SanitizeFileName |
| tests/Aspire.Hosting.Maui.Tests/MauiProjectResourceValidationTests.cs | Added 7 tests validating AddMauiProject null/empty arguments, ProjectPath property, resource name, and resource visibility in AppModel |
| tests/Aspire.Hosting.Maui.Tests/MauiWithArgsTests.cs | Added 11 tests verifying dotnet run CLI arguments per platform (TFM, AdbTarget, RuntimeIdentifier, _DeviceName, OpenArguments) |
| tests/Aspire.Hosting.Maui.Tests/MauiEnvironmentHelperTests.cs | Added 12 tests for Android/iOS MSBuild targets XML generation, EncodeSemicolons, and SanitizeFileName utility methods |
| tests/Aspire.Hosting.Maui.Tests/MauiUnsupportedPlatformTests.cs | Added 7 tests verifying UnsupportedPlatformAnnotation presence/absence per OS (Windows, macOS, Android, iOS) |
| tests/Aspire.Hosting.Maui.Tests/MauiiOSValidationTests.cs | Added 6 tests for iOS device/simulator UDID cross-validation (GUID vs non-GUID format detection) |
| tests/Aspire.Hosting.Maui.Tests/MauiOtlpTemplateTests.cs | Added 9 tests ensuring OTLP environment variables don't contain DCP template placeholders ({{...}}) after evaluation |
11af73f to
df12ffc
Compare
- Add Aspire.Hosting.Maui.Tests to Aspire.slnx so tests run in CI
(72 existing tests were never included in the main solution)
- Add 60 new tests covering previously untested areas:
- AddMauiProject input validation and resource creation
- Command-line args per platform (TFM, AdbTarget, _DeviceName, RuntimeIdentifier)
- MauiEnvironmentHelper utilities (targets XML, EncodeSemicolons, SanitizeFileName)
- UnsupportedPlatformAnnotation on unsupported OS
- iOS device/simulator ID cross-validation (GUID vs non-GUID)
- OTLP template placeholder replacement (no {{ DCP templates in env vars)
- Change 4 private methods in MauiEnvironmentHelper to internal for testability
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
df12ffc to
c8c6fa4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
\Aspire.Hosting.Maui.Tests\ has never run in CI — it was only included in a dynamically generated \AspireWithMaui.slnx\ created by
estore.cmd -mauirestore, which no CI workflow references. This PR fixes that and adds comprehensive test coverage.
Changes
Enable existing tests in CI
Add 60 new tests covering previously untested areas
Production code change
Test results
\
total: 132, failed: 0, succeeded: 131, skipped: 1
\\
The 1 skipped test is \WindowsDevice_OnNonWindows_HasUnsupportedPlatformAnnotation\ which correctly skips on Windows (uses \Assert.Skip).