-
Notifications
You must be signed in to change notification settings - Fork 17
feat(AssertionLibrary): Add assertion library choice to templates #1659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat(AssertionLibrary): Add assertion library choice to templates #1659
Conversation
…sed default to none
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a new assertion library selection feature for Uno templates, addressing the commercial licensing changes in FluentAssertions v8.0. The change enables users to choose between FluentAssertions, Shouldly, or no assertion library when creating new projects from templates.
- Adds an
assertionLibraryparameter to template configurations with three options: none, Shouldly, and FluentAssertions - Refactors existing templates to conditionally include assertion libraries based on user selection
- Updates global usings and test files to support multiple assertion library choices
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
.template.config/template.json |
Adds assertion library choice parameter and computed symbols |
.template.config/dotnetcli.host.json |
Exposes assertion library parameter to CLI |
.template.config/TemplateWizard.json |
Integrates assertion library selection into Visual Studio wizard |
*.csproj |
Conditionally includes assertion library package references |
GlobalUsings.cs |
Conditionally imports assertion library namespaces |
AppInfoTests.cs |
Implements conditional assertion logic for different libraries |
Directory.Build.targets |
Adds Shouldly version configuration |
Uno.Templates.csproj |
Adds Shouldly version replacement logic |
src/Uno.Templates/content/unoapp/MyExtensionsApp.1.Tests/AppInfoTests.cs
Outdated
Show resolved
Hide resolved
| <PackageReference Include="FluentAssertions" VersionOverride="$FluentAssertions$" /> | ||
| <!--#endif--> | ||
| <!--#if (useShouldly)--> | ||
| <PackageReference Include="Shouldly" VersionOverride="$ShouldlyVersion$" /> |
Copilot
AI
Jul 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version placeholder '$ShouldlyVersion$' is inconsistent with the replacement pattern '$Shouldly$' defined in Uno.Templates.csproj line 49. This will prevent proper version substitution during template processing.
| <PackageReference Include="Shouldly" VersionOverride="$ShouldlyVersion$" /> | |
| <PackageReference Include="Shouldly" VersionOverride="$Shouldly$" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 not sure about that, since Uno.Templates.csproj pattern is using Replacement Text with the Version postfix
could somone check this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking at Directory.Build.targets file the ShouldlyVersion parameter should be correctly but the FluentAssertions parameter might miss that Version postfix
GitHub Issue (If applicable): closes #1607
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Creating a new Project from template, will always include FluentAssertions Package, which is up from v8.0 commercial and paid.
for more information about the reason this should be made available to activly select, see the linked issues.
What is the new behavior?
This PR should enable us users to activly choose IF and WHICH assertion Library we want to use.
PR Checklist
Please check if your PR fulfills the following requirements:
Other information
Partially about Parent issue of 1607 : #1605
@MartinZikmund @jeromelaban
Its likly, as this is my first time with dotnet templates, that there will be some issues made so would be great to get some help ❤️ I tryed my best to follow the templating wiki of the CLI
Would add an xUnit Testing project option at some later point in a seperate PR to improve it for #1258
This PR needs help on:
as there is no schema for the TemplateWizard.json available, I would assume, that uses a internal flow. I added a Property "NestedIn" for the assertionLibrary symbols, but would need someone from the team to implement or update this. Maybe if it is a own schema you are using (and this file is overall used) it would be great if you could add such schema reference in the repository
Internal Issue (If applicable):