querylenshq/ef-querylens/tsp-csharp-xunit
Claude Code and agent skill by querylenshq/ef-querylens
Trust tier 2
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
Comprehensive xUnit testing guide for C# projects. Use when writing unit tests, setting up test projects, creating data-driven tests, mocking dependencies, or organizing test suites.
Install
npx vskill@latest install querylenshq/ef-querylens/tsp-csharp-xunitSKILL.md
xUnit Testing — TSP Standards
Project Setup
- Test project name:
{ProjectName}.Tests - Required packages:
Microsoft.NET.Test.Sdk,xunit,xunit.runner.visualstudio - Recommended:
FluentAssertions,NSubstitute(orMoq) - Run tests:
dotnet test(use--filterfor targeted runs)
Test Structure
- No test class attribute required (unlike MSTest/NUnit)
- Use constructor for per-test setup; implement
IDisposablefor teardown - Use
IClassFixture<T>for shared context within a test class - Use
ICollectionFixture<T>for shared context across test classes - Use
IAsyncLifetimefor async setup/teardown
Naming Conventions
- Test class:
{ClassUnderTest}Tests - Test method:
{Method}_{Scenario}_{ExpectedResult} - Examples:
GetUser_WhenIdIsInvalid_ReturnsNotFoundCalculateTotal_WithDiscount_AppliesPercentageSaveAsync_WhenCancelled_ThrowsOperationCancelled
Data-Driven Tests
[Theory]+[InlineData]for simple inline values[Theory]+[MemberData]for method/property-based data[Theory]+[ClassData]for reusable data generators- Use meaningful parameter names that describe the scenario
Assertions
- Prefer
FluentAssertionswhen available: result.Should().Be(expected)collection.Should().HaveCount(3).And.Contain(x => x.IsActive)act.Should().ThrowAsync<InvalidOperationException>()- Built-in xUnit assertions as fallback:
Assert.Equal,Assert.True,Assert.Throws<T>Assert.Contains/Assert.DoesNotContainfor collections- One logical behavior per test — multiple assertions are fine if testing one concept
Mocking
- Prefer
NSubstitutefor readability;Moqis also acceptable - Mock interfaces, not concrete classes
- Verify interactions only when the interaction IS the behavior being tested
- Avoid over-mocking — if you're mocking more than 3 dependencies, the class may need refactoring
Test Organization
- Group tests by feature or component
- Use
[Trait("Category", "Integration")]for categorization - Skip tests with
Skip = "reason"when conditionally disabled - Use
ITestOutputHelperfor diagnostic output (notConsole.WriteLine)
Rules
- Tests must run in any order and in parallel — no shared mutable state
- Avoid disk I/O — use in-memory alternatives or mocks
- No
Thread.Sleep— useTask.Delaywith cancellation tokens in async tests - Every new or changed public API must have corresponding tests
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.github/skills/tsp-csharp-xunit/SKILL.md
Popularity
- Repository stars
- 225
- Repository forks
- 6
- 7-day trend score
- 27
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 30 Apr 2026, 6 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/querylenshq/ef-querylens/tsp-csharp-xunit)