dotnet-testing

dotnet-testing is a cursor rule for Cursor from adonai-labs/agent-runway. It costs 0 tokens per session (1,348 once invoked), scanned A, original, MIT.

A set of testing standards for .NET and ASP.NET Core applications, covering test names, project layout, unit tests, integration tests, and test tools.

In plain words
What is it for?
Use it to name tests, arrange test projects, test services and handlers, build integration tests, and use tools such as Testcontainers and WebApplicationFactory.
Why use it?
It makes tests easier to understand and keeps different kinds of application tests organised consistently.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Good fit Use it to name tests, arrange test projects, test services and handlers, build integration tests, and use tools such as Testcontainers and WebApplicationFactory.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/adonai-labs/agent-runway/dotnet-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.

Clone the repo
git clone --depth 1 https://github.com/adonai-labs/agent-runway

Made for: Cursor.

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 dotnet-testing

README.md
[![agentmods](https://agentmods.dev/badge/rules/adonai-labs/agent-runway/dotnet-testing/github.svg)](https://agentmods.dev/rules/adonai-labs/agent-runway/dotnet-testing)
Your own site
<a href="https://agentmods.dev/rules/adonai-labs/agent-runway/dotnet-testing"><img src="https://agentmods.dev/badge/rules/adonai-labs/agent-runway/dotnet-testing/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for dotnet-testing

Your own site · 80×15
<a href="https://agentmods.dev/rules/adonai-labs/agent-runway/dotnet-testing"><img src="https://agentmods.dev/badge/rules/adonai-labs/agent-runway/dotnet-testing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,348 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.
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.00000 $0.01348
Opus 5 $0.00000 $0.00674
Sonnet 5 $0.00000 $0.00270
Haiku 4.5 $0.00000 $0.00135

Measured 12d ago against content hash 930ed5f80b66, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-16, from the pricing page.

Security

Grade A, and why

dotnet-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 12d 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.

src/stacks/dotnet/dotnet-testing.mdc · 195 lines

How it starts

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

.NET Testing Standards

.NET-specific testing practices. For universal testability principles, see engineering-principles.mdc. For test strategy (what to test at each layer), see dotnet-architecture.mdc.

Conflict resolution: Where this file provides .NET-specific guidance that differs from engineering-principles.mdc, this file takes precedence for .cs and .csproj files.


Test naming

Use the MethodName_StateUnderTest_ExpectedBehaviour format for unit tests and Given_When_Then for scenario-based integration tests:

// Unit test — method under test is explicit
[Fact]
public async Task PlaceOrder_WhenCustomerHasInsufficientCredit_ReturnsFailure() { }

// Integration test — scenario is explicit
[Fact]
public async Task GivenAuthenticatedUser_WhenPlacingOrderWithInvalidLines_ThenReturnsBadRequest() { }
  • Test class name matches the subject under test: OrderServiceTests, PlaceOrderCommandHandlerTests
  • Do not use Test suffix on test project folders; use MyApp.Application.Tests

Project structure

tests/
├── MyApp.Domain.Tests/          ← entity and value object behaviour
├── MyApp.Application.Tests/     ← handler, validator, pipeline behaviour
├── MyApp.Infrastructure.Tests/  ← EF Core, HTTP clients, adapters
└── MyApp.Api.Tests/             ← full request/response via WebApplicationFactory

Each test project references only the layer it tests; it does not skip layers.


Unit tests — handlers and domain

  • Use xUnit with FluentAssertions; avoid raw Assert.* calls
  • No infrastructure dependencies; stub with NSubstitute or Moq
  • Arrange/Act/Assert sections separated by a blank line; no inline comments labelling them
[Fact]
public async Task Handle_WhenOrderNotFound_ReturnsFailure()
{
    var repository = Substitute.For<IOrderRepository>();
    repository.GetByIdAsync(Arg.Any<Guid>(), Arg.Any<CancellationToken>())
              .Returns((Order?)null);

    var handler = new GetOrderByIdQueryHandler(repository);
    var result = await handler.Handle(new GetOrderByIdQuery(Guid.NewGuid()), default);

    result.IsFailure.Should().BeTrue();
    result.Error.Should().Contain("not found");
}

Read the full file on GitHub · 195 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. 12d ago First seen · 195 lines · 1,348 tokens per session scan A 930ed5f80b66

Subscribe to this mod's changes

dotnet-testing is a cursor rule published in the GitHub repository adonai-labs/agent-runway (2 stars, last pushed 26d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,348 tokens. 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-09-03.