You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .codex/skills/dotnet-xunit/references/anti-patterns.md
+9-8Lines changed: 9 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,9 +65,9 @@ public class UserServiceTests
65
65
}
66
66
```
67
67
68
-
## Excessive Mocking
68
+
## Test Doubles Instead of Behavior
69
69
70
-
Over-mocking creates brittle tests that verify implementation rather than behavior.
70
+
Stub, Fake, and Mock doubles are forbidden by default. They create brittle tests when they replace behavior that should be proven through real implementations, Aspire-managed resources, or observable state.
71
71
72
72
Bad:
73
73
@@ -114,9 +114,9 @@ public class OrderServiceTests
114
114
[Fact]
115
115
publicvoidPlaceOrder_ValidOrder_ReturnsOrderId()
116
116
{
117
-
// Arrange - use real implementations where cheap, mock only external boundaries
117
+
// Arrange - use real implementations and observable state
Copy file name to clipboardExpand all lines: .codex/skills/dotnet-xunit/references/patterns.md
+17-60Lines changed: 17 additions & 60 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -214,75 +214,33 @@ public class StringUtilityTests
214
214
}
215
215
```
216
216
217
-
## Mocking with NSubstitute
217
+
## Aspire-First Boundary Tests
218
218
219
-
Prefer NSubstitute for readable substitute configuration:
219
+
For hosted, integration, browser, or infrastructure-backed behavior, prefer an Aspire-managed AppHost and real resources. Stub, Fake, and Mock doubles are forbidden by default; use them only with a documented exception and removal plan.
Copy file name to clipboardExpand all lines: .codex/skills/dotnet-xunit/references/xunit.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,15 @@ VSTest compatibility package when the repo intentionally uses that runner:
19
19
dotnet add package xunit.runner.visualstudio
20
20
```
21
21
22
+
Aspire CLI is mandatory alongside MCAF/.NET test setup when the repo has integration, browser, hosted, or infrastructure-backed tests:
23
+
24
+
```bash
25
+
curl -sSL https://aspire.dev/install.sh | bash
26
+
aspire --version
27
+
```
28
+
29
+
Do not add mocking libraries as part of default xUnit setup. Stub, Fake, and Mock doubles are forbidden by default and require a documented exception with a removal plan.
30
+
22
31
## Verify First
23
32
24
33
Before adding packages, check what the repo already references:
Copy file name to clipboardExpand all lines: .codex/skills/mcaf-solution-governance/references/dotnet-agents-pattern.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,13 @@
3
3
Use this reference when the solution stack is .NET and the root or local `AGENTS.md` needs concrete command and tooling guidance.
4
4
The `.NET` skill bundle itself lives in the [Managed Code Skills catalog](https://skills.managed-code.com/), not in this repository.
5
5
6
+
When installing or documenting MCAF for a .NET repository, also install Aspire CLI whenever the repo has integration, browser, hosted, or infrastructure-backed tests:
7
+
8
+
```bash
9
+
curl -sSL https://aspire.dev/install.sh | bash
10
+
aspire --version
11
+
```
12
+
6
13
## Root AGENTS.md Expectations
7
14
8
15
Record the real commands, not placeholders:
@@ -76,6 +83,8 @@ For each .NET project or module, record:
76
83
- the active test framework
77
84
- the active runner model
78
85
- the coverage driver if the module runs coverage in isolation
86
+
- the Aspire command when the module owns integration, browser, hosted, or infrastructure-backed tests
87
+
- the local rule that Stub, Fake, and Mock doubles are forbidden by default and require a documented exception
Copy file name to clipboardExpand all lines: .codex/skills/mcaf-solution-governance/references/project-agents-template.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,7 @@ Parent: `../AGENTS.md`
29
29
-`test`: `...`
30
30
-`format`: `...`
31
31
-`analyze`: `...` (delete if not used)
32
+
-`aspire`: `aspire run ...` (required when this project owns integration tests, browser tests, or infrastructure-backed tests)
32
33
33
34
For .NET projects also document:
34
35
@@ -42,6 +43,13 @@ For .NET projects also document:
42
43
-`...`
43
44
44
45
For .NET projects, install the needed `.NET` skills from the [Managed Code Skills catalog](https://skills.managed-code.com/).
46
+
Aspire CLI is mandatory with MCAF/.NET setup when the repo has integration, browser, hosted, or infrastructure-backed tests. Install and validate it:
47
+
48
+
```bash
49
+
curl -sSL https://aspire.dev/install.sh | bash
50
+
aspire --version
51
+
```
52
+
45
53
The local skill list usually includes:
46
54
47
55
-`mcaf-testing`
@@ -63,3 +71,7 @@ The local skill list usually includes:
63
71
64
72
- Project-specific rules go here.
65
73
- Local rules may tighten root rules, but must not weaken them silently.
74
+
- Stub, Fake, and Mock doubles are forbidden by default; avoid them and use real implementations, Aspire-managed resources, public APIs, or user-visible flows.
75
+
- If a Stub, Fake, or Mock is unavoidable, document why in the nearest test or durable doc and include a removal plan.
76
+
- Integration tests and browser tests must run only through Aspire-managed AppHost orchestration.
77
+
- Keep infrastructure required by integration or browser coverage in Aspire projects/resources instead of ad hoc test startup code.
Copy file name to clipboardExpand all lines: .codex/skills/mcaf-testing/SKILL.md
+10-5Lines changed: 10 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,11 +47,14 @@ compatibility: "Requires the repository’s build and test tooling; uses command
47
47
-`mcaf-dotnet-xunit`
48
48
-`mcaf-dotnet-tunit`
49
49
-`mcaf-dotnet-mstest`
50
-
5. Prefer integration, API, or UI coverage when behaviour crosses boundaries.
51
-
6. Prove the user flow or caller-visible system flow, not just internal details.
52
-
7. Add a regression test for every bug that can be captured reliably.
53
-
8. If the stack is .NET and production code changed, do not stop at tests only. Finish with the repo-defined format and analyzer pass as well.
54
-
9. Use deeper testing references only when the repo’s current strategy is unclear.
50
+
5. When installing or validating MCAF/.NET test setup, require Aspire CLI for integration, browser, hosted, or infrastructure-backed tests. Install with `curl -sSL https://aspire.dev/install.sh | bash` on macOS/Linux and validate with `aspire --version`.
51
+
6. Prefer Aspire-backed integration, API, or UI coverage when behaviour crosses boundaries.
52
+
7. Treat Stub, Fake, and Mock doubles as forbidden by default. Use real implementations, Aspire-managed resources, public APIs, or user-visible flows instead.
53
+
8. Allow a Stub, Fake, or Mock only when the real dependency cannot practically run through Aspire or when an interaction has no observable state or output. Document the reason and removal plan.
54
+
9. Prove the user flow or caller-visible system flow, not just internal details.
55
+
10. Add a regression test for every bug that can be captured reliably.
56
+
11. If the stack is .NET and production code changed, do not stop at tests only. Finish with the repo-defined format and analyzer pass as well.
57
+
12. Use deeper testing references only when the repo’s current strategy is unclear.
55
58
56
59
## Deliver
57
60
@@ -63,6 +66,8 @@ compatibility: "Requires the repository’s build and test tooling; uses command
63
66
- the new behaviour is covered at the right level
64
67
- the main user flow or caller-visible system flow is proven
65
68
- tests assert meaningful outcomes, not implementation trivia
69
+
- Stub, Fake, and Mock doubles are absent, or every exception has a documented reason and removal plan
70
+
- infrastructure-backed tests run through Aspire instead of ad hoc startup code
66
71
- coverage expectations from `AGENTS.md` are met, or the exception is documented
67
72
- the verification sequence matches `AGENTS.md`
68
73
- for .NET changes, tests were not treated as a substitute for formatting or analyzer gates
Copy file name to clipboardExpand all lines: AGENTS.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -171,6 +171,12 @@ List only the skills this repository should actively use.
171
171
- Bug fixes start with a failing regression test when practical.
172
172
- Test user-visible behavior and boundary contracts, not only internal implementation details.
173
173
- Prefer realistic verification over mock-heavy tests.
174
+
- Stub, Fake, and Mock test doubles are forbidden by default. Avoid them and prove behavior through real implementations, Aspire-managed resources, public APIs, or user-visible flows.
175
+
- A Stub may only supply deterministic indirect input, a Fake may only replace a dependency that cannot practically run in Aspire, and a Mock may only verify an interaction that has no observable state or output. Every exception must be documented in the nearest test or durable doc with the reason and removal plan.
176
+
- Aspire CLI is a required local prerequisite alongside the MCAF skill setup. Install it with `curl -sSL https://aspire.dev/install.sh | bash` on macOS/Linux and verify with `aspire --version`.
177
+
- All repository tests must be able to run under Aspire orchestration when the test surface depends on application hosting, services, browsers, or external infrastructure.
178
+
- Integration tests and browser tests must run only through Aspire-managed AppHost orchestration; do not create parallel ad hoc service startup, browser host, container, database, queue, cache, or emulator infrastructure outside Aspire for those tests.
179
+
- Test infrastructure that supports integration or browser coverage belongs in Aspire projects and Aspire resources so local, CI, and future runtime verification use the same orchestration path. Prefer moving more verification into Aspire whenever infrastructure, hosting, or end-to-end behavior is involved.
174
180
- Flaky tests are failures and must be fixed, not ignored.
175
181
- Active runtime CI coverage gates must stay at or above 90% unless an ADR explicitly changes that policy.
176
182
- Repository or module coverage must not go down without an explicit written exception.
Copy file name to clipboardExpand all lines: SDK/dotnet/tests/ManagedCode.Tps.Tests/AGENTS.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,3 +65,6 @@ For this .NET project:
65
65
- Keep test project namespaces under `ManagedCode.Tps.Tests`.
66
66
- Do not move production logic into test helpers.
67
67
- Prefer behavior-oriented tests over implementation-detail assertions.
68
+
- Stub, Fake, and Mock doubles are forbidden by default; use real implementations and Aspire-managed resources unless an exception is documented with a reason and removal plan.
69
+
- Keep integration and browser tests Aspire-owned: they must use the repository AppHost and Aspire-managed resources instead of starting local infrastructure directly from tests.
70
+
- Keep any infrastructure required by integration or browser coverage in Aspire projects/resources so `aspire run` remains the canonical orchestration path.
0 commit comments