maui-unit-testing

maui-unit-testing is a skill for Claude Code, Codex from dotnet/maui-labs. It costs 84 tokens per session (954 once invoked), scanned A, original, MIT.

A testing guide for .NET MAUI applications, with an emphasis on testing app logic separately from the visual interface. Unit tests check small pieces of code in isolation, while integration or device tests cover real platform behavior.

In plain words
What is it for?
Use it to add xUnit tests, test ViewModels and services, create fakes or mocks, and decide when device or integration testing is necessary.
Why use it?
It helps test ViewModels and services without starting a phone or simulator for every test. It also shows how to replace device services such as storage, location, media, and navigation with test substitutes.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to add xUnit tests, test ViewModels and services, create fakes or mocks, and decide when device or integration testing is necessary.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/dotnet/maui-labs/maui-unit-testing
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add dotnet/maui-labs --skill maui-unit-testing
Clone the repo
git clone --depth 1 https://github.com/dotnet/maui-labs

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for maui-unit-testing

README.md
[![agentmods](https://agentmods.dev/badge/skills/dotnet/maui-labs/maui-unit-testing.svg)](https://agentmods.dev/skills/dotnet/maui-labs/maui-unit-testing)
Your own site
<a href="https://agentmods.dev/skills/dotnet/maui-labs/maui-unit-testing"><img src="https://agentmods.dev/badge/skills/dotnet/maui-labs/maui-unit-testing.svg" alt="Measured on agentmods" height="20"></a>
Per session 84 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 954 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00084 $0.00954
Opus 5 $0.00042 $0.00477
Sonnet 5 $0.00017 $0.00191
Haiku 4.5 $0.00008 $0.00095

Measured 4d ago against content hash 7e6015138689, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

maui-unit-testing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/dotnet-maui/skills/maui-unit-testing/SKILL.md · 111 lines

How it starts

The opening of the file, as written. The whole thing — 111 lines — stays where its author put it; the contents beside it link to each section on GitHub.

MAUI Unit Testing

Use this skill to make MAUI app logic testable without requiring every test to start a device or simulator. Keep UI framework dependencies at the edges.

Workflow

  1. Identify what is being tested: ViewModel, service, navigation abstraction, storage wrapper, platform capability, or UI integration.
  2. For ViewModels and services, create a normal xUnit test project.
  3. Introduce interfaces around platform APIs such as geolocation, preferences, secure storage, media picker, file picker, and navigation.
  4. Use fakes or mocks for those interfaces in unit tests.
  5. Use device/integration tests only for behavior that requires handlers, platform permissions, native controls, or OS services.
  6. If a test or tooling project must reference a MAUI app project, use the AppProjectReference support provided by Microsoft.Maui.Build.AppProjectReference instead of forcing the app project to behave like a normal class library.

Test Boundary Guide

Test target Test type
ViewModel commands, validation, state transitions Unit test
API/data service with fake handler Unit test
Secure storage wrapper behavior with fake storage Unit test
Shell route strings and navigation abstraction calls Unit test
Handler rendering, native permissions, real pickers Device/integration test
End-to-end UI flow in a running app DevFlow/runtime automation

ViewModel Test Pattern

Always show at least a happy-path test AND an error/edge-case test. Use a mocking library (NSubstitute, Moq) or a hand-rolled fake — both are valid.

public sealed class ProductsViewModelTests
{
    [Fact]
    public async Task LoadAsync_ServiceReturnsProducts_PopulatesProducts()
    {
        var service = Substitute.For<IProductsService>();
        service.LoadAsync().Returns([new Product("Coffee")]);
        var viewModel = new ProductsViewModel(service);

        await viewModel.LoadAsync();

        Assert.Single(viewModel.Products);
        Assert.Equal("Coffee", viewModel.Products[0].Name);
    }

    [Fact]
    public async Task LoadAsync_ServiceThrows_SetsErrorState()
    {
        var service = Substitute.For<IProductsService>();
        service.LoadAsync().Returns(Task.FromException<IReadOnlyList<Product>>(
            new HttpRequestException("offline")));
        var viewModel = new ProductsViewModel(service);

        await viewModel.LoadAsync();

        Assert.Empty(viewModel.Products);
        Assert.NotNull(viewModel.ErrorMessage);
    }
}

Read the full file on GitHub · 111 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago Changed · -49 tokens per session 7e6015138689
  2. 8d ago First seen · 111 lines · 133 tokens per session scan A 84d59cf2c591

Subscribe to this mod's changes

maui-unit-testing is a skill published in the GitHub repository dotnet/maui-labs (213 stars, last pushed yesterday), licensed MIT. It adds 84 tokens to every session and 954 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

ios-testing

Testing patterns for Swift and SwiftUI apps.

TalissonVitorino/kmp-ios-skills · 69 tokens

mobile-testing

Android and JVM testing - JUnit5, MockK, Turbine for Flow, and Compose UI testing for unit, integration, and UI tests; also applies to KMP commonTest running on the JVM/Android target. For iOS/Swift tests (XCTest, Swift Testing, XCUITest) use ios-testing. For TDD methodology and the three-tier test model (fake-first…

TalissonVitorino/kmp-ios-skills · 102 tokens

argent-test-ui-flow

Autonomously test an app UI (iOS or Android) by running interact-screenshot-verify loops using argent MCP tools. Use when testing UI flows, verifying login works, testing navigation, running end-to-end UI test scenarios, manual QA steps, visible UI changes, or visual behavior.

software-mansion/argent · 64 tokens

mobile-automation

Control Android and iOS devices, emulators and simulators — launch apps, tap, swipe, type, take screenshots, read the accessibility tree. Use when a task involves a mobile device or app, mobile UI testing, or reproducing a bug on a phone.

mobile-next/mobile-mcp · 58 tokens

argent-create-flow

Create, record, edit, replay, or repair reusable Argent flow YAML files. Use when the user asks to record or replay a repeatable device path, set up profiling or an A/B comparison, or invoke the authoring engine behind argent-qa-flows. Also use before repeating three or more interactions. For one-off UI checks…

software-mansion/argent · 100 tokens

argent-ios-device-interact

Drive a physical iPhone through argent. Use when a physical iPhone is involved (a list-devices iOS entry with kind "device") and ONLY then; never for a simulator. For cable, trust, or signing problems read argent-ios-device-setup.

software-mansion/argent · 59 tokens