Agent skill

Maui Unit Testing

by davidortinau in davidortinau/maui-skills

xUnit testing guidance for .NET MAUI apps — ViewModel testing, mocking MAUI services, test project setup, code coverage, and on-device test runners.

MITAuto-check passedMobile

Install Maui Unit Testing

skills CLI
$ npx skills add davidortinau/maui-skills --skill maui-unit-testing -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install davidortinau/maui-skills maui-unit-testing --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/davidortinau/maui-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/maui-skills/skills/maui-unit-testing .claude/skills/maui-unit-testing && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
maui-unit-testing
GitHub stars
174
Token cost
~1.2k tokens
SKILL.md length
269 words
Files
2 (incl. references)
Skills in repo
41
Repo updated
First seen
Licence
MIT

At a glance

xUnit testing guidance for .NET MAUI apps — ViewModel testing, mocking MAUI services, test project setup, code coverage, and on-device test runners.

  • : unit test MAUI
  • SKILL.md covers ⚠️ TFM Trap: Don't Use…, ⚠️ OutputType Trap: App…, Common Mistakes and Mocking Strategy for MAUI…, plus 3 more sections
  • Calls dotnet
  • ViewModel testing

What it does

Maui Unit Testing is an agent skill from davidortinau/maui-skills. xUnit testing guidance for .NET MAUI apps — ViewModel testing, mocking MAUI services, test project setup, code coverage, and on-device test runners. USE FOR: "unit test MAUI", "xUnit test", "ViewModel testing", "mock MAUI services", "test project setup", "code coverage", "on-device test runner", "test MAUI app", "IServiceProvider mock", "Moq MAUI". DO NOT USE FOR: UI automation testing (use appium-automation), performance profiling (use maui-performance), or dependency injection setup (use…

Its SKILL.md is about 1.2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including reference files (for example `references/unit-testing-api.md`).

It sits in Mobile, covering Unit testing and Cross-platform mobile apps. The repository describes itself as: .NET MAUI skills for GitHub Copilot and Claude Code. The licence is MIT.

When your agent uses it

  • : unit test MAUI
  • ViewModel testing
  • Mock MAUI services
  • Test project setup

Example prompts

  • “unit test MAUI”
  • “xUnit test”
  • “ViewModel testing”
  • “/maui-unit-testing”

What it can do on your machine

Read from SKILL.md and the folder at commit 79bb4bf. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • dotnet

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Maui Unit Testing loads about 1.2k tokens when it runs, and up to ~2.1k if it reads all its reference files. Until then it costs about 135 tokens; SKILL.md has 269 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~135
When it runs · the whole SKILL.md, loaded when a task matches
~1.2k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~2.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from davidortinau/maui-skills at commit 79bb4bf, republished under its MIT licence (© davidortinau). 269 words, ~1,153 tokens.

Download SKILL.mdSave it as .claude/skills/maui-unit-testing/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
maui-unit-testing
description
xUnit testing guidance for .NET MAUI apps — ViewModel testing, mocking MAUI services, test project setup, code coverage, and on-device test runners. USE FOR: "unit test MAUI", "xUnit test", "ViewModel testing", "mock MAUI services", "test project setup", "code coverage", "on-device test runner", "test MAUI app", "IServiceProvider mock", "Moq MAUI". DO NOT USE FOR: UI automation testing (use appium-automation), performance profiling (use maui-performance), or dependency injection setup (use maui-dependency-injection).

.NET MAUI Unit Testing — Gotchas & Best Practices

For project templates, xUnit examples, ViewModel test patterns, and CLI commands, see references/unit-testing-api.md.

⚠️ TFM Trap: Don't Use Platform-Specific TFMs

xml
<!-- ❌ xUnit can't run on platform-specific TFMs -->
<TargetFramework>net9.0-ios</TargetFramework>

<!-- ✅ Use plain .NET TFM for desktop test host -->
<TargetFrameworks>net9.0;net10.0</TargetFrameworks>

⚠️ OutputType Trap: App Project as Test Dependency

If your test project references the app project, the app tries to build as Exe for the test TFM — this fails. Add a conditional OutputType:

xml
<!-- ❌ App .csproj without conditional — breaks test builds -->
<OutputType>Exe</OutputType>

<!-- ✅ Library for test TFM, Exe for platform TFMs -->
<PropertyGroup Condition="'$(TargetFramework)' == 'net9.0'">
  <OutputType>Library</OutputType>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' != 'net9.0'">
  <OutputType>Exe</OutputType>
</PropertyGroup>

Common Mistakes

❌ Using Static MAUI APIs in ViewModels

ViewModels that directly call static MAUI APIs are untestable:

csharp
// ❌ Untestable — Shell.Current requires a running MAUI app
public async Task GoToDetail(int id)
    => await Shell.Current.GoToAsync($"detail?id={id}");

// ✅ Inject an interface — fully testable
public class MyViewModel(INavigationService nav)
{
    public async Task GoToDetail(int id)
        => await nav.GoToAsync($"detail?id={id}");
}

Static APIs to wrap behind interfaces:

  • Shell.Current → INavigationService
  • Application.Current → avoid entirely
  • SecureStorage.Default → ISecureStorage
  • Connectivity.Current → IConnectivity
❌ Asserting on UI Bindings Instead of ViewModel State
csharp
// ❌ Testing the binding — fragile, needs a running UI
Assert.Equal("Hello", label.Text);

// ✅ Testing the ViewModel — fast, no platform dependency
Assert.Equal("Hello", viewModel.Title);
Assert.True(viewModel.SaveCommand.CanExecute(null));

Mocking Strategy for MAUI Services

MAUI ServiceMock Strategy
ISecureStorageMock<ISecureStorage> — stub GetAsync/SetAsync
IPreferencesMock<IPreferences> — stub Get/Set/Remove
IConnectivityMock<IConnectivity> — return NetworkAccess
IGeolocationMock<IGeolocation> — return fixed Location
IFilePickerMock<IFilePicker> — return FileResult
IMediaPickerMock<IMediaPicker> — return FileResult
Shell navigationAbstract behind INavigationService
IDispatcherStub Dispatch to invoke action synchronously

Architecture: Interface-First for Testability

Define service interfaces so ViewModels have zero MAUI platform dependencies:

csharp
// ✅ These make your entire ViewModel layer testable
public interface INavigationService
{
    Task GoToAsync(string route);
    Task GoBackAsync();
}

public interface IDialogService
{
    Task<bool> ConfirmAsync(string title, string message);
}

Register implementations in MauiProgram.cs; inject interfaces into ViewModels.

Tips

  • No Application.Current or Shell.Current in ViewModels — wrap in injectable services
  • Use ObservableCollection<T> and [ObservableProperty] (MVVM Toolkit) for testable state
  • Assert on ViewModel properties and CanExecute, not UI bindings
  • Use TaskCompletionSource to test async waiting flows
  • Run dotnet test in CI to catch regressions early
  • On-device tests: Use xunit.runner.devices for real platform APIs (sensors, camera, Bluetooth)

Checklist

  • Test project targets plain net9.0/net10.0 (not platform-specific TFMs)
  • App project has conditional OutputType for test TFM
  • All MAUI static APIs wrapped behind injectable interfaces
  • ViewModels tested via properties and commands, not UI bindings
  • IDispatcher mocked to invoke synchronously in tests
  • dotnet test runs green in CI

© davidortinau, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file (references) in plugins/maui-skills/skills/maui-unit-testing of davidortinau/maui-skills.

  • SKILL.md
  • references/unit-testing-api.md

Open the folder on GitHubat commit 79bb4bf

Compare with similar skills

Maui Unit Testing next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Maui Unit Testing compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Maui Unit Testing this skilldavidortinau/maui-skills174—~1.2kAutomated safety check: PassMIT
Flutter TesterFNOSP/FlyNarwhal495—~1.4kAutomated safety check: PassAGPL-3.0
BlocVeryGoodOpenSource/vgv-ai-flutter-plugin169—~2kAutomated safety check: PassMIT
Flutter Testingmakifbaysal/tasktrooper109—~1.3kAutomated safety check: PassApache-2.0
Creating Reanimated Animationsgluestack/gluestack-ui5.3k—~2.4kAutomated safety check: PassNone
Improve Code Coveragealexvanyo/composelife267—~1.1kAutomated safety check: PassApache-2.0

Similar skills

  • Flutter Tester

    FNOSP/FlyNarwhal

    A skill your agent uses when creating, writing, fixing, or reviewing tests in a Flutter project.

    495 GitHub stars~1.4k tokensUpdated 2 days ago
    MobileAuto-check passed
  • Bloc

    VeryGoodOpenSource/vgv-ai-flutter-plugin

    Best practices for Bloc state management in Flutter/Dart, covering Cubit versus Bloc, event and state naming, sealed classes with Equatable, the Page/View split with BlocProvider, BlocBuilder…

    169 GitHub stars~2k tokensUpdated 2 days ago
    MobileAuto-check passed
  • Flutter Testing

    makifbaysal/tasktrooper

    A skill your agent uses when testing Flutter code - unit tests for logic, widget tests for UI behavior, golden tests for appearance, the multi-size/text-scale/dark matrix, accessibility guidelines…

    109 GitHub stars~1.3k tokensUpdated yesterday
    MobileAuto-check passed
  • Creating Reanimated Animations

    gluestack/gluestack-ui

    Generate React Native Reanimated animation code for React Native apps.

    5.3k GitHub stars~2.4k tokensUpdated 1 mo ago
    MobileAuto-check passed
  • Improve Code Coverage

    alexvanyo/composelife

    Helps increment code coverage in this Kotlin Multiplatform project.

    267 GitHub stars~1.1k tokensUpdated yesterday
    MobileAuto-check passed
  • React Native Testing

    callstackincubator/agent-skills

    Official

    Write tests using React Native Testing Library (RNTL) v13 and v14 (@testing-library/react-native).

    1.7k GitHub stars~1.8k tokensUpdated 2 days ago
    MobileAuto-check passed

More from davidortinau/maui-skills

All 41 skills in this repo
  • Maui Hot Reload Diagnostics

    davidortinau/maui-skills

    Diagnose and troubleshoot .NET MAUI Hot Reload issues (C Hot Reload, XAML Hot Reload, Blazor Hybrid).

    174 GitHub stars~1.3k tokensUpdated 3 mo ago
    Auto-check passed
  • Maui Accessibility

    davidortinau/maui-skills

    Guide for making .NET MAUI apps accessible — screen reader support via SemanticProperties, heading levels, AutomationProperties visibility control, programmatic focus and announcements, and…

    174 GitHub stars~974 tokensUpdated 3 mo ago
    Auto-check passed
  • Maui Animations

    davidortinau/maui-skills

    .NET MAUI view animations, custom animations, easing functions, rotation, scale, translation, and fade effects.

    174 GitHub stars~911 tokensUpdated 3 mo ago
    Auto-check passed
  • Maui App Icons Splash

    davidortinau/maui-skills

    .NET MAUI app icon configuration, splash screen setup, SVG to PNG conversion at build time, composed/adaptive icons, and platform-specific icon and splash screen requirements for Android, iOS, Mac…

    174 GitHub stars~995 tokensUpdated 3 mo ago
    Auto-check passed
  • Maui App Lifecycle

    davidortinau/maui-skills

    .NET MAUI app lifecycle guidance covering the four app states (not running, running, deactivated, stopped), cross-platform Window lifecycle events, backgrounding and resume behaviour…

    174 GitHub stars~947 tokensUpdated 3 mo ago
    Auto-check passed
  • Maui Aspire

    davidortinau/maui-skills

    Guide for .NET MAUI apps consuming .NET Aspire-hosted backend services.

    174 GitHub stars~1.3k tokensUpdated 3 mo ago
    Auto-check passed

Questions about Maui Unit Testing

What does Maui Unit Testing do?

xUnit testing guidance for .NET MAUI apps — ViewModel testing, mocking MAUI services, test project setup, code coverage, and on-device test runners. Maui Unit Testing is an agent skill from davidortinau/maui-skills.NET MAUI apps — ViewModel testing, mocking MAUI services, test project setup, code coverage, and on-device test runners.

When should I use Maui Unit Testing?

Maui Unit Testing fits situations like: : unit test MAUI; viewModel testing; mock MAUI services; test project setup.

How do I install Maui Unit Testing in Claude Code?

Run `npx skills add davidortinau/maui-skills --skill maui-unit-testing -a claude-code`. Or copy the skill folder (plugins/maui-skills/skills/maui-unit-testing in davidortinau/maui-skills) into .claude/skills/maui-unit-testing in your project. Claude Code loads it when a task matches its description.

How do I install Maui Unit Testing in Codex?

Run `npx skills add davidortinau/maui-skills --skill maui-unit-testing -a codex`. Or copy the skill folder (plugins/maui-skills/skills/maui-unit-testing in davidortinau/maui-skills) into .agents/skills/maui-unit-testing in your project. Codex loads it when a task matches its description.

Can I use Maui Unit Testing in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add davidortinau/maui-skills --skill maui-unit-testing -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/maui-unit-testing, .gemini/skills/maui-unit-testing, .github/skills/maui-unit-testing and .opencode/skills/maui-unit-testing in your project.

What does Maui Unit Testing need to run?

Going by SKILL.md and its folder, Maui Unit Testing needs the command-line tools its instructions call (dotnet).

Does Maui Unit Testing access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Maui Unit Testing safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Maui Unit Testing use?

Maui Unit Testing is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Maui Unit Testing use?

About 1.2k tokens (SKILL.md is roughly 4.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 981 tokens, read only when the agent opens those files.

What are the alternatives to Maui Unit Testing?

Skills that share tags, products or a category with Maui Unit Testing: Flutter Tester (FNOSP/FlyNarwhal, 495 stars), Bloc (VeryGoodOpenSource/vgv-ai-flutter-plugin, 169 stars), Flutter Testing (makifbaysal/tasktrooper, 109 stars) and Creating Reanimated Animations (gluestack/gluestack-ui, 5.3k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Maui Unit Testing?

davidortinau (a GitHub user) maintains it in davidortinau/maui-skills, which has 174 GitHub stars. The repository holds 41 skills in this directory. The repository was last updated on July 6, 2026.

Source: davidortinau/maui-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.