Infra, Ops & WorkflowSûr100100/100

Write Xaml Tests (.NET)

Creates XAML unit tests for GitHub issues in the Controls.Xaml.UnitTests project. Tests XAML parsing, compilation (XamlC), and source generation. Use when testing XAML-specific behavior, not UI interactions.

ou envoie-le directement à ton agent.

Installer dans ton projet

$ curl -fsSL https://arboristhree.xyz/cli/install-skill.mjs -o /tmp/arboris-install-skill.mjs && node /tmp/arboris-install-skill.mjs write-xaml-tests__dotnet-maui__github-skills-6e08c14955ae
Contenu à copier
---
name: write-xaml-tests
description: Creates XAML unit tests for GitHub issues in the Controls.Xaml.UnitTests project. Tests XAML parsing, compilation (XamlC), and source generation. Use when testing XAML-specific behavior, not UI interactions.
metadata:
  origin: .NET
  author: Stephane Delcroix
  version: "1.0"
compatibility: Requires .NET SDK for building and running xUnit tests.
---

# Write XAML Tests Skill

Creates XAML unit tests that verify XAML parsing, XamlC compilation, and source generation behavior.

## When to Use

- ✅ Testing XAML parsing/inflation behavior
- ✅ Testing XamlC (IL generation) correctness
- ✅ Testing Source Generator output
- ✅ XAML-specific bugs (bindings, markup extensions, x:Name, etc.)

## When NOT to Use

- ❌ Testing UI interactions or visual behavior → Use `write-ui-tests` skill
- ❌ Testing runtime behavior after page loads → Use `write-ui-tests` skill
- ❌ Testing platform-specific rendering → Use `write-ui-tests` skill

## Required Input

Before invoking, ensure you have:
- **Issue number** (e.g., 12345)
- **Issue description** - what XAML behavior is broken
- **Expected vs actual behavior**

## Workflow

### Step 1: Read the XAML Unit Test Guidelines

```bash
cat .github/instructions/xaml-unittests.instructions.md
```

This contains the authoritative conventions for:
- File naming (`MauiXXXXX.xaml` and `MauiXXXXX.xaml.cs`)
- File location (`src/Controls/tests/Xaml.UnitTests/Issues/`)
- Test patterns with `[Values] XamlInflator`
- XamlC testing with `MockCompiler`
- Source Generator testing with `MockSourceGenerator`
- Special file extensions for invalid codegen (`.rt.xaml`, `.rtsg.xaml`, `.rtxc.xaml`)

### Step 2: Create Test Files

Following the conventions from Step 1, create:
- `src/Controls/tests/Xaml.UnitTests/Issues/MauiXXXXX.xaml`
- `src/Controls/tests/Xaml.UnitTests/Issues/MauiXXXXX.xaml.cs`

### Step 3: Verify Tests Compile and Run

```bash
# Build the test project
dotnet build src/Controls/tests/Xaml.UnitTests/Controls.Xaml.UnitTests.csproj -c Debug --no-restore -v q

# Run specific test
dotnet test src/Controls/tests/Xaml.UnitTests/Controls.Xaml.UnitTests.csproj --filter "FullyQualifiedName~MauiXXXXX" --no-build
```

### Step 4: Verify Test Behavior

- **For bug reproduction tests**: Tests should FAIL before fix, PASS after fix
- **For regression tests**: Tests should PASS to confirm behavior works

## Output

After completion, report:

```markdown
✅ XAML unit test created for Issue #XXXXX

**Files:**
- `src/Controls/tests/Xaml.UnitTests/Issues/MauiXXXXX.xaml`
- `src/Controls/tests/Xaml.UnitTests/Issues/MauiXXXXX.xaml.cs`

**Test method:** `DescriptiveTestName`
**Inflators tested:** Runtime, XamlC, SourceGen
**Verification:** Tests [PASS/FAIL] as expected
```

## References

- **Full conventions:** `.github/instructions/xaml-unittests.instructions.md`
- **Test project:** `src/Controls/tests/Xaml.UnitTests/`
- **Existing issue tests:** `src/Controls/tests/Xaml.UnitTests/Issues/`
Colle ce Markdown dans ton agent ou utilise les boutons ci-dessus pour l’écrire dans ton projet.

Ce que fait Write Xaml Tests (.NET)

✅ Testing XAML parsing/inflation behavior
✅ Testing XamlC (IL generation) correctness
✅ Testing Source Generator output
✅ XAML-specific bugs (bindings, markup extensions, x:Name, etc.)

Comment utiliser Write Xaml Tests (.NET)

1
Copie le prompt
Un clic copie le prompt packagé (ou l'envoie à ton agent).
2
L'agent installe le skill
Il ajoute le SKILL.md et ses ressources à ton projet.
3
Activation automatique
Le skill s'active dès que le contexte correspond.

Déclencheurs pour Write Xaml Tests (.NET)

Dis simplement à ton agent quelque chose comme :

Applique le skill write-xaml-tests__dotnet-maui__github-skills-6e08c14955ae à cette tâche
Utilise write-xaml-tests__dotnet-maui__github-skills-6e08c14955ae pour améliorer cette implémentation
Passe en revue ce sujet avec write-xaml-tests__dotnet-maui__github-skills-6e08c14955ae

Skills liés à Write Xaml Tests (.NET)

Add CLI Command (.NET)
Add or change a dotnet CLI command, subcommand, or option across the relevant CLI projects. USE FOR: adding or changing a dotnet CLI command/subcommand, adding a new Option<T> or Argument<T>, registering a subcommand in the command tree, changing an option's help description or a command's runtime message, wiring a command parser, or updating --help output.
Add Dotnet Aot Command (.NET)
Add, enable, or review a dotnet CLI command or feature in the Native AOT CLI (src/Cli/dotnet-aot) and prove its compatibility. USE FOR: migrating a command or option to AOT, reviewing an AOT migration PR, defining conservative eligibility and managed fallback, changing AotSourceFiles.props or AotDependencies.props, validating AOT/managed parity, NativeAOT-publishing tests, checking binary-size impact, or using the dn harness and separated SDK layout. DO NOT USE FOR: resolving IL trim/AOT analyzer warnings alone (use dotnet-aot-compat), running dotnet.Tests incrementally (use incremental-test), or pure managed CLI work.
Add Net Analyzer (.NET)
Add, port, or change a .NET code analysis rule (CA####) under src/Microsoft.CodeAnalysis.NetAnalyzers. USE FOR: implementing a new CA analyzer and its code fixer, porting a rule or PR from the retired dotnet/roslyn-analyzers repo, allocating a diagnostic ID from DiagnosticCategoryAndIdRanges.txt, choosing RuleLevel/severity/category, wiring resx + xlf strings, recording the rule in AnalyzerReleases.Unshipped.md, regenerating the analyzer documentation/sarif files, and writing MSTest analyzer/code-fix tests with the VerifyCS/VerifyVB harness. DO NOT USE FOR: NETSDK#### MSBuild diagnostics (src/Tasks), CS####/BC#### compiler diagnostics or IDE#### analyzers (dotnet/roslyn), or CONTAINER#### diagnostics (src/Containers).