{"id":"08aab5d8-58dc-456e-9b9d-410bc5a44316","shortId":"sqhkV4","kind":"skill","title":"Csharp Xunit","tagline":"Awesome Copilot skill by Github","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"],"capabilities":["skill","source-github","category-awesome-copilot"],"categories":["awesome-copilot"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/github/awesome-copilot/csharp-xunit","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"install_from":"skills.sh"}},"qualityScore":"0.300","qualityRationale":"deterministic score 0.30 from registry signals: · indexed on skills.sh · published under github/awesome-copilot","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:v1","enrichmentVersion":1,"enrichedAt":"2026-04-22T14:40:17.325Z","embedding":null,"createdAt":"2026-04-18T20:25:45.020Z","updatedAt":"2026-04-22T14:40:17.325Z","lastSeenAt":"2026-04-22T14:40:17.325Z","tsv":"'aaa':99 'act':97 'alongsid':284 'approach':31 'arrang':96 'arrange-act-assert':95 'assert':98,155,162,231,270,275 'assert.contains':249 'assert.doesnotcontain':250 'assert.doesnotmatch':255 'assert.equal':233 'assert.false':244 'assert.matches':254 'assert.same':238 'assert.throws':261 'assert.throwsasync':264 'assert.true':243 'attribut':78,89,192,218,345 'avoid':145,179 'await':263 'awesom':3 'base':85,204,212 'behavior':144,148 'best':9 'boolean':246 'calcul':62 'calculatortest':60 'case':168 'categor':320 'categori':317 'category-awesome-copilot' 'categorynam':318 'class':52,56,77,126,135,211 'class-bas':210 'classdata':208 'clear':154 'collect':252,322 'combin':188 'command':67 'complex':304 'compon':314 'condit':247,339 'consid':279,298,330 'constructor':110 'contain':302 'context':121,131 'convent':41 'copilot':4 'cover':23 'creat':50,215 'csharp':1 'custom':216 'data':28,183,190,198,206,214,217,228 'data-driven':27,182,227 'dataattribut':221 'depend':287,329 'di':301 'diagnost':336 'dotnet':68 'driven':29,184,229 'e.g':59 'effect':18 'equal':236,241 'except':267 'expectedbehavior':108 'express':157 'facilit':296 'fact':84,88 'fact-bas':83 'fact/theory':344 'featur':312 'fixtur':323 'fluent':269 'focus':140 'follow':93 'github':7 'goal':12 'group':309,325 'help':15 'helper':332 'iclassfixtur':118 'icollectionfixtur':128 'idempot':173 'idisposable.dispose':114 'implement':220 'includ':159 'independ':171 'inlin':196 'inlinedata':194 'intent':158 'interdepend':181 'interfac':294 'isol':278,289 'itestoutputhelp':333 'keep':138 'librari':271 'make':169 'match':54,259 'meaning':223 'memberdata':200 'method':152,203 'method-bas':202 'methodnam':106 'microsoft.net.test.sdk':45 'mock':276,286,297 'moq':281 'mstest/nunit':81 'multipl':133,147 'name':40,101,225 'need':163 'net':64 'nsubstitut':283 'one':150 'order':178 'organ':308 'output':331 'packag':49 'paramet':224 'pattern':100,105,258 'practic':10 'project':32,38 'projectnam':42 'readabl':274 'reason':342 'refer':44,240 'regex':257 'requir':79 'run':71,175 'scenario':107 'sdk':65 'separ':36 'setup':33,112,306 'share':120,130,328 'simpl':91 'singl':143 'skill':5 'skip':337,341 'sourc':191 'source-github' 'standard':25,136 'structur':74 'teardown':116 'test':20,30,37,43,51,58,66,69,72,73,76,86,92,102,123,134,137,139,146,151,167,170,180,185,197,205,213,230,266,292,305,307,310,326,335,338 'theori':187 'trait':316 'unit':19,290 'unlik':80 'use':34,63,82,103,109,117,127,153,186,193,199,207,222,232,237,242,248,253,260,268,280,293,299,315,321 'valu':235 'verifi':165 'write':17 'xunit':2,8,22,46,285 'xunit.runner.visualstudio':48","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-04-22T12:52:10.562Z"},{"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-04-22T14:40:17.325Z"}],"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","source":"skills_sh","category":"awesome-copilot","skills_sh_url":"https://skills.sh/github/awesome-copilot/csharp-xunit"},"updatedAt":"2026-04-22T14:40:17.325Z"}}