{"id":"08aab5d8-58dc-456e-9b9d-410bc5a44316","shortId":"sqhkV4","kind":"skill","title":"csharp-xunit","tagline":"Get best practices for XUnit unit testing, including data-driven tests","description":"# XUnit Best Practices\n\nYour goal is to help me write effective unit tests with XUnit, covering both standard and data-driven testing approaches.\n\n## Project Setup\n\n- Use a separate test project with naming convention `[ProjectName].Tests`\n- Reference Microsoft.NET.Test.Sdk, xunit, and xunit.runner.visualstudio packages\n- Create test classes that match the classes being tested (e.g., `CalculatorTests` for `Calculator`)\n- Use .NET SDK test commands: `dotnet test` for running tests\n\n## Test Structure\n\n- No test class attributes required (unlike MSTest/NUnit)\n- Use fact-based tests with `[Fact]` attribute for simple tests\n- Follow the Arrange-Act-Assert (AAA) pattern\n- Name tests using the pattern `MethodName_Scenario_ExpectedBehavior`\n- Use constructor for setup and `IDisposable.Dispose()` for teardown\n- Use `IClassFixture<T>` for shared context between tests in a class\n- Use `ICollectionFixture<T>` for shared context between multiple test classes\n\n## Standard Tests\n\n- Keep tests focused on a single behavior\n- Avoid testing multiple behaviors in one test method\n- Use clear assertions that express intent\n- Include only the assertions needed to verify the test case\n- Make tests independent and idempotent (can run in any order)\n- Avoid test interdependencies\n\n## Data-Driven Tests\n\n- Use `[Theory]` combined with data source attributes\n- Use `[InlineData]` for inline test data\n- Use `[MemberData]` for method-based test data\n- Use `[ClassData]` for class-based test data\n- Create custom data attributes by implementing `DataAttribute`\n- Use meaningful parameter names in data-driven tests\n\n## Assertions\n\n- Use `Assert.Equal` for value equality\n- Use `Assert.Same` for reference equality\n- Use `Assert.True`/`Assert.False` for boolean conditions\n- Use `Assert.Contains`/`Assert.DoesNotContain` for collections\n- Use `Assert.Matches`/`Assert.DoesNotMatch` for regex pattern matching\n- Use `Assert.Throws<T>` or `await Assert.ThrowsAsync<T>` to test exceptions\n- Use fluent assertions library for more readable assertions\n\n## Mocking and Isolation\n\n- Consider using Moq or NSubstitute alongside XUnit\n- Mock dependencies to isolate units under test\n- Use interfaces to facilitate mocking\n- Consider using a DI container for complex test setups\n\n## Test Organization\n\n- Group tests by feature or component\n- Use `[Trait(\"Category\", \"CategoryName\")]` for categorization\n- Use collection fixtures to group tests with shared dependencies\n- Consider output helpers (`ITestOutputHelper`) for test diagnostics\n- Skip tests conditionally with `Skip = \"reason\"` in fact/theory attributes","tags":["csharp","xunit","awesome","copilot","github","agent-skills","agents","custom-agents","github-copilot","hacktoberfest","prompt-engineering"],"capabilities":["skill","source-github","skill-csharp-xunit","topic-agent-skills","topic-agents","topic-awesome","topic-custom-agents","topic-github-copilot","topic-hacktoberfest","topic-prompt-engineering"],"categories":["awesome-copilot"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/github/awesome-copilot/csharp-xunit","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add github/awesome-copilot","source_repo":"https://github.com/github/awesome-copilot","install_from":"skills.sh"}},"qualityScore":"0.700","qualityRationale":"deterministic score 0.70 from registry signals: · indexed on github topic:agent-skills · 33270 github stars · SKILL.md body (2,592 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-18T18:52:09.357Z","embedding":null,"createdAt":"2026-04-18T20:25:45.020Z","updatedAt":"2026-05-18T18:52:09.357Z","lastSeenAt":"2026-05-18T18:52:09.357Z","tsv":"'aaa':107 'act':105 'alongsid':292 'approach':39 'arrang':104 'arrange-act-assert':103 'assert':106,163,170,239,278,283 'assert.contains':257 'assert.doesnotcontain':258 'assert.doesnotmatch':263 'assert.equal':241 'assert.false':252 'assert.matches':262 'assert.same':246 'assert.throws':269 'assert.throwsasync':272 'assert.true':251 'attribut':86,97,200,226,353 'avoid':153,187 'await':271 'base':93,212,220 'behavior':152,156 'best':5,17 'boolean':254 'calcul':70 'calculatortest':68 'case':176 'categor':328 'categori':325 'categorynam':326 'class':60,64,85,134,143,219 'class-bas':218 'classdata':216 'clear':162 'collect':260,330 'combin':196 'command':75 'complex':312 'compon':322 'condit':255,347 'consid':287,306,338 'constructor':118 'contain':310 'context':129,139 'convent':49 'cover':31 'creat':58,223 'csharp':2 'csharp-xunit':1 'custom':224 'data':13,36,191,198,206,214,222,225,236 'data-driven':12,35,190,235 'dataattribut':229 'depend':295,337 'di':309 'diagnost':344 'dotnet':76 'driven':14,37,192,237 'e.g':67 'effect':26 'equal':244,249 'except':275 'expectedbehavior':116 'express':165 'facilit':304 'fact':92,96 'fact-bas':91 'fact/theory':352 'featur':320 'fixtur':331 'fluent':277 'focus':148 'follow':101 'get':4 'goal':20 'group':317,333 'help':23 'helper':340 'iclassfixtur':126 'icollectionfixtur':136 'idempot':181 'idisposable.dispose':122 'implement':228 'includ':11,167 'independ':179 'inlin':204 'inlinedata':202 'intent':166 'interdepend':189 'interfac':302 'isol':286,297 'itestoutputhelp':341 'keep':146 'librari':279 'make':177 'match':62,267 'meaning':231 'memberdata':208 'method':160,211 'method-bas':210 'methodnam':114 'microsoft.net.test.sdk':53 'mock':284,294,305 'moq':289 'mstest/nunit':89 'multipl':141,155 'name':48,109,233 'need':171 'net':72 'nsubstitut':291 'one':158 'order':186 'organ':316 'output':339 'packag':57 'paramet':232 'pattern':108,113,266 'practic':6,18 'project':40,46 'projectnam':50 'readabl':282 'reason':350 'refer':52,248 'regex':265 'requir':87 'run':79,183 'scenario':115 'sdk':73 'separ':44 'setup':41,120,314 'share':128,138,336 'simpl':99 'singl':151 'skill' 'skill-csharp-xunit' 'skip':345,349 'sourc':199 'source-github' 'standard':33,144 'structur':82 'teardown':124 'test':10,15,28,38,45,51,59,66,74,77,80,81,84,94,100,110,131,142,145,147,154,159,175,178,188,193,205,213,221,238,274,300,313,315,318,334,343,346 'theori':195 'topic-agent-skills' 'topic-agents' 'topic-awesome' 'topic-custom-agents' 'topic-github-copilot' 'topic-hacktoberfest' 'topic-prompt-engineering' 'trait':324 'unit':9,27,298 'unlik':88 'use':42,71,90,111,117,125,135,161,194,201,207,215,230,240,245,250,256,261,268,276,288,301,307,323,329 'valu':243 'verifi':173 'write':25 'xunit':3,8,16,30,54,293 'xunit.runner.visualstudio':56","prices":[{"id":"cc6791b4-ab1e-4d61-aefc-580512b75fb8","listingId":"08aab5d8-58dc-456e-9b9d-410bc5a44316","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"github","category":"awesome-copilot","install_from":"skills.sh"},"createdAt":"2026-04-18T20:25:45.020Z"}],"sources":[{"listingId":"08aab5d8-58dc-456e-9b9d-410bc5a44316","source":"github","sourceId":"github/awesome-copilot/csharp-xunit","sourceUrl":"https://github.com/github/awesome-copilot/tree/main/skills/csharp-xunit","isPrimary":false,"firstSeenAt":"2026-04-18T21:49:02.889Z","lastSeenAt":"2026-05-18T18:52:09.357Z"},{"listingId":"08aab5d8-58dc-456e-9b9d-410bc5a44316","source":"skills_sh","sourceId":"github/awesome-copilot/csharp-xunit","sourceUrl":"https://skills.sh/github/awesome-copilot/csharp-xunit","isPrimary":true,"firstSeenAt":"2026-04-18T20:25:45.020Z","lastSeenAt":"2026-05-07T22:40:17.925Z"}],"details":{"listingId":"08aab5d8-58dc-456e-9b9d-410bc5a44316","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"github","slug":"csharp-xunit","github":{"repo":"github/awesome-copilot","stars":33270,"topics":["agent-skills","agents","ai","awesome","custom-agents","github-copilot","hacktoberfest","prompt-engineering"],"license":"mit","html_url":"https://github.com/github/awesome-copilot","pushed_at":"2026-05-18T01:26:59Z","description":"Community-contributed instructions, agents, skills, and configurations to help you make the most of GitHub Copilot.","skill_md_sha":"4347c5aa5aceb5b7f2704660aafa62837046c357","skill_md_path":"skills/csharp-xunit/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/github/awesome-copilot/tree/main/skills/csharp-xunit"},"layout":"multi","source":"github","category":"awesome-copilot","frontmatter":{"name":"csharp-xunit","description":"Get best practices for XUnit unit testing, including data-driven tests"},"skills_sh_url":"https://skills.sh/github/awesome-copilot/csharp-xunit"},"updatedAt":"2026-05-18T18:52:09.357Z"}}