[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6BTC40BEY037H9053T8E13S":3,"skill-same:01M6BTC40BEY037H9053T8E13S":81},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":18,"categories":19,"keywords":30,"publishedAt":53,"linkOnly":54,"markdownContent":55,"markdownBody":56,"frontMatter":57,"refName":58,"commitSha":59,"skillDirectory":60,"forksCount":61,"repositoryHtmlUrl":62,"repositoryHomepageUrl":17,"ownerHtmlUrl":63,"ownerBlogUrl":64,"ownerDescription":65,"updatedAt":66,"install":67,"resources":80},"01M6BTC40BEY037H9053T8E13S","csharp-azure-spector-coverage-gaps","Azure C# Spector 测试覆盖补全","Discovers and implements gaps in Spector test coverage for the Azure C# HTTP client emitter. Use when asked to find missing Spector scenarios, add Spector test coverage, or implement a specific Spector spec for the Azure C# emitter. Can also compare coverage between the Azure dashboard and the Standard (TypeSpec core) dashboard.","发现并实现 Azure C# HTTP 客户端 emitter 的 Spector 测试覆盖缺口。当被要求查找缺失的 Spector 场景、添加 Spector 测试覆盖，或为 Azure C# emitter 实现特定 Spector 规范时使用。还可比较 Azure 仪表板与 Standard（TypeSpec 核心）仪表板之间的覆盖情况。","Azure\u002Fazure-sdk-for-net","Azure","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6844498?v=4","01M6BT15ZBDTV4D9RM7HCC4D8A","Microsoft Azure","01M6BT163EEHB7Y52MKZJ322Q8",6072,"MIT",null,"https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-net\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fcsharp-azure-spector-coverage-gaps\u002FSKILL.md",[20,25],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQGD5WG86P4AQ5GPSSKBFR","测试工程师","PROFESSION","适用职业",{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BQJH394GT47X57A9Q8G7HX","测试与质量保障","SCENARIO","使用场景",[31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52],"gaps","azure","coverage gaps","csharp","csharp azure spector coverage gaps","coverage","when","spec","standard","for","can","http client","add","missing","test coverage","use","core","typespec","http","test","dashboard","implement","2026-11-10 10:12:30",false,"---\nname: csharp-azure-spector-coverage-gaps\ndescription: Discovers and implements gaps in Spector test coverage for the Azure C# HTTP client emitter. Use when asked to find missing Spector scenarios, add Spector test coverage, or implement a specific Spector spec for the Azure C# emitter. Can also compare coverage between the Azure dashboard and the Standard (TypeSpec core) dashboard.\n---\n\n# Discovering and implementing Spector coverage gaps for the Azure C# emitter\n\n## Overview\n\nThis skill discovers which Spector scenarios the Azure C# emitter (`@azure-tools\u002Ftypespec-csharp`) does **not** yet cover, then implements the missing test(s). Spector scenarios are defined in two packages:\n\n- **Standard specs**: `@typespec\u002Fhttp-specs` — general HTTP client scenarios\n- **Azure specs**: `@azure-tools\u002Fazure-http-specs` — Azure-specific scenarios (core, LRO, paging, resource-manager, etc.)\n\nTwo coverage dashboards exist:\n\n| Dashboard | URL | Scope |\n|-----------|-----|-------|\n| **Standard** | \u003Chttps:\u002F\u002Ftypespec.io\u002Fcan-i-use\u002Fhttp\u002F> | Standard HTTP specs only |\n| **Azure** | \u003Chttps:\u002F\u002Fazure.github.io\u002Ftypespec-azure\u002Fcan-i-use\u002Fhttp\u002F> | Standard + Azure specs |\n\n> **Tip:** Comparing the two dashboards reveals Standard scenarios where the Azure emitter lags behind (or ahead of) the core TypeSpec C# emitter in `microsoft\u002Ftypespec`.\n\n> **Note:** `{PKG}` refers to `\u003Crepo-root>\u002Feng\u002Fpackages\u002Fhttp-client-csharp` throughout this document.\n\n## Inputs\n\nYou may receive one of:\n\n- **\"Find coverage gaps\"** — discover all missing scenarios and present them.\n- **\"Compare Azure vs Standard dashboards\"** — identify Standard scenarios covered on typespec.io but not on the Azure dashboard (or vice versa).\n- **Spector spec link** — a link to a specific spec under `packages\u002Fhttp-specs\u002Fspecs\u002F...` or `packages\u002Fazure-http-specs\u002Fspecs\u002F...`.\n- **Spec name** — e.g., `http\u002Fencode\u002Fduration`, `http\u002Fazure\u002Fcore\u002Flro\u002Fstandard`, `http\u002Ftype\u002Funion\u002Fdiscriminated`.\n\n## Output\n\n- A report of coverage gaps (when discovering).\n- A comparison table of Standard vs Azure dashboard coverage (when comparing).\n- New or updated C# NUnit test file(s) under `{PKG}\u002Fgenerator\u002FTestProjects\u002FSpector.Tests\u002FHttp\u002F`.\n- Updated `{PKG}\u002Fgenerator\u002FTestProjects\u002FSpector.Tests\u002FTestProjects.Spector.Tests.csproj` if a new project reference is needed.\n- Regenerated client code (via `Generate.ps1`).\n\n## Workflow\n\n- [ ] Ensure prerequisites are met (npm ci, npm run build)\n- [ ] Discover coverage gaps or identify the target spec\n- [ ] Verify the spec is not in the failing specs list\n- [ ] Generate the C# client for the target spec (unstubbed, or use Test-Spector.ps1)\n- [ ] Read the generated client to understand the API surface\n- [ ] Read the TypeSpec scenario file to understand expected behavior\n- [ ] Find or create the test file\n- [ ] Implement the test(s) following existing conventions\n- [ ] Run the tests using `Test-Spector.ps1 -filter \"\u003Cspec-path>\"`\n- [ ] Validate all tests pass\n\n---\n\n## Prerequisites — Environment setup\n\nBefore starting, ensure the build environment is ready.\n\n1. **Install dependencies** (from `{PKG}`):\n   ```powershell\n   cd {PKG}\n   npm ci\n   ```\n2. **Build the package**:\n   ```powershell\n   npm run build\n   ```\n\n> ⚠️ Do NOT run `pnpm install` or `pnpm build` at the repo root — only the http-client-csharp package build is needed.\n\n---\n\n## Step 1 — Discover coverage gaps\n\nBefore identifying missing scenarios, compare the working branch with current upstream `Azure\u002Fazure-sdk-for-net` main and check the dashboard report's generator commit and spec version. An older fork or dependency pin can make already-implemented scenarios appear missing locally.\n\n### How specs are organized\n\nThe Azure C# emitter tests specs from **two sources**:\n\n1. **Standard HTTP specs** (`@typespec\u002Fhttp-specs`): Located at `{PKG}\u002Fnode_modules\u002F@typespec\u002Fhttp-specs\u002Fspecs\u002F`\n2. **Azure HTTP specs** (`@azure-tools\u002Fazure-http-specs`): Located at `{PKG}\u002Fnode_modules\u002F@azure-tools\u002Fazure-http-specs\u002Fspecs\u002F`\n\n### How specs are filtered\n\nThe file `{PKG}\u002Feng\u002Fscripts\u002FSpector-Helper.psm1` defines which specs are included\u002Fexcluded.\n\n**Failing\u002Fexcluded specs** are defined in the `$failingSpecs` array. Always check that file for the current list — do not hardcode specs here.\n\nCurrent exclusions fall into three categories:\n\n1. **Standard spec issues**: `type\u002Ffile`\n2. **Azure specs not yet buildable**: `azure\u002Fclient-generator-core\u002Fdeserialize-empty-string-as-null`\n3. **Delegated to management generator**: All `azure\u002Fresource-manager\u002F*` specs (common-properties, non-resource, operation-templates, resources, large-header, method-subscription-id, multi-service variants)\n\n### Discovering gaps programmatically\n\nCompare available specs against existing tests. Run this from `{PKG}`:\n\n```powershell\nImport-Module \"{PKG}\u002Feng\u002Fscripts\u002FSpector-Helper.psm1\" -DisableNameChecking -Force\n\n# Get all valid specs\n$specs = Get-Sorted-Specs | ForEach-Object { Get-SubPath $_ }\n\n# Get all test files\n$testFiles = Get-ChildItem -Path \"{PKG}\u002Fgenerator\u002FTestProjects\u002FSpector.Tests\u002FHttp\" -Recurse -Filter \"*Tests.cs\" |\n    ForEach-Object { $_.FullName }\n\n# For each spec, check if a corresponding test directory\u002Ffile exists\nforeach ($spec in $specs) {\n    $specParts = $spec -replace '\u002F', '\\' -split '\\\\'\n    $testPath = \"{PKG}\u002Fgenerator\u002FTestProjects\u002FSpector.Tests\u002FHttp\"\n    # ... check if test exists\n}\n```\n\n### Comparing Azure vs Standard dashboards\n\nThe two dashboards report coverage for different scopes:\n\n- **Standard dashboard** (typespec.io): Shows coverage for `@typespec\u002Fhttp-specs` scenarios only, reported by the base `@typespec\u002Fhttp-client-csharp` emitter in the `microsoft\u002Ftypespec` repo.\n- **Azure dashboard** (azure.github.io\u002Ftypespec-azure): Shows coverage for **both** `@typespec\u002Fhttp-specs` and `@azure-tools\u002Fazure-http-specs` scenarios, reported by the `@azure-tools\u002Ftypespec-csharp` emitter in this repo.\n\n**To find gaps between the two dashboards:**\n\n1. Open both dashboards side-by-side.\n2. For each Standard scenario shown as ✅ on typespec.io but ❌\u002Fmissing on the Azure dashboard, that is a **regression or missing port** from the base emitter.\n3. For each Standard scenario shown as ❌ on typespec.io but ✅ on the Azure dashboard, that is an **Azure-only enhancement**.\n4. Azure-specific scenarios (`azure\u002F*`) only appear on the Azure dashboard.\n\nCommon causes of Standard coverage gaps in Azure:\n- The base emitter in `microsoft\u002Ftypespec` added a test that hasn't been ported here yet.\n- The Azure emitter excludes a spec (check `$failingSpecs` in `Spector-Helper.psm1`).\n- Namespace or build conflicts specific to the Azure generator (e.g., `Response` vs `Azure.Response`).\n\n### Existing test coverage\n\n**Standard spec test directories** (under `Spector.Tests\u002FHttp\u002F`):\n\n```\nAuthentication\u002F   (ApiKey, Http\u002FCustom, OAuth2, Union)\nClient\u002F           (ClientNamespace, Naming, Overload, Structure\u002F*)\nEncode\u002F           (Array, Bytes, DateTime, Duration, Numeric)\nParameters\u002F       (Basic, BodyOptionality, CollectionFormat, Path, Query, Spread)\nPayload\u002F          (ContentNegotiation, JsonMergePatch, MediaType, MultiPart, Pageable, Xml)\nResiliency\u002F       (SrvDriven\u002FV1, SrvDriven\u002FV2)\nRoutes\u002F\nSerialization\u002F    (EncodedName\u002FJson)\nServer\u002F           (Endpoint\u002FNotDefined, Path\u002FMultiple, Path\u002FSingle, Versions\u002F*)\nService\u002F\nSpecialHeaders\u002F   (ConditionalRequest, Repeatability)\nSpecialWords\u002F\nStreaming\u002F        (Jsonl, Sse, including SSE protocol metadata and explicit resumption)\nVersioning\u002F       (Added, MadeOptional, Removed, RenamedFrom, ReturnTypeChangedFrom, TypeChangedFrom)\n_Type\u002F            (Array, Dictionary, Enum\u002F*, Model\u002F*, Property\u002F*, Scalar, Union)\n```\n\n**Azure spec test directories** (under `Spector.Tests\u002FHttp\u002FAzure\u002F`):\n\n```\nClientGeneratorCore\u002F  (Access, AlternateType, ApiVersion\u002F*, ClientInitialization\u002F*, ClientLocation\u002F*, HierarchyBuilding, Override, Usage)\nCore\u002F                 (Basic, Lro\u002FRpc, Lro\u002FStandard, Model, Page, Scalar, Traits)\nEncode\u002F               (Duration)\nExample\u002F              (Basic)\nPayload\u002F              (Pageable)\nSpecialHeaders\u002F       (ClientRequestId)\nVersioning\u002F           (PreviewVersion\u002FV1, PreviewVersion\u002FV2)\n```\n\n### Accurate gap detection\n\nThe naive approach of matching spec paths to test directory names can produce false positives because:\n\n- C# reserved words get underscore-prefixed in test dirs (e.g., `type\u002F` → `_Type\u002F`, `array` → `_Array`, `enum` → `_Enum`)\n- kebab-case gets converted to PascalCase (e.g., `content-negotiation` → `ContentNegotiation`)\n- Some test files cover a parent spec but not sub-specs (e.g., `UnionTests.cs` covers `type\u002Funion` but NOT `type\u002Funion\u002Fdiscriminated`)\n- Response specs use `_Response\u002F` test namespaces and aliased project references to avoid conflicts with `Azure.Response`.\n\n**To find real gaps**, verify each candidate by checking whether a test _directory_ exists for the spec's exact path, including sub-paths. A test file at a parent level does NOT cover child specs.\n\n> **Important:** The gap list evolves over time. Always re-run the comparison to get current gaps. All committed Spector libraries are stubbed — `[SpectorTest]` will auto-skip tests unless you regenerate with `-Stubbed $false` or use `Test-Spector.ps1`.\n\n### Understanding stubbed vs unstubbed generation\n\nAll Spector libraries **committed to the repository are stubbed**. `Generate.ps1` defaults to `$Stubbed = $true`, which causes the emitter to use `AzureStubGenerator` instead of `AzureClientGenerator`. Stubbed clients use expression-bodied constructors (`=>`) instead of block bodies (`{ }`), and the `[SpectorTest]` attribute automatically skips tests for stubbed clients.\n\nTo generate **unstubbed** code (for local testing), pass `-Stubbed $false`:\n\n```powershell\npwsh eng\u002Fscripts\u002FGenerate.ps1 -filter \"\u003Cspec-path>\" -Stubbed $false\n```\n\nHowever, the recommended way to test is via `Test-Spector.ps1` (see Step 7), which handles the unstubbed regeneration, test execution, and directory restoration automatically.\n\n---\n\n## Step 2 — Read the spec to understand expected behavior\n\nSpec files live in:\n- **Standard**: `{PKG}\u002Fnode_modules\u002F@typespec\u002Fhttp-specs\u002Fspecs\u002F`\n- **Azure**: `{PKG}\u002Fnode_modules\u002F@azure-tools\u002Fazure-http-specs\u002Fspecs\u002F`\n\nIf `node_modules` is not installed, specs can also be found in the upstream repos:\n- \u003Chttps:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Ftypespec\u002Ftree\u002Fmain\u002Fpackages\u002Fhttp-specs\u002Fspecs>\n- \u003Chttps:\u002F\u002Fgithub.com\u002FAzure\u002Ftypespec-azure\u002Ftree\u002Fmain\u002Fpackages\u002Fazure-http-specs\u002Fspecs>\n\nEach spec contains:\n\n- **`main.tsp`** — the TypeSpec definition with `@scenario` and `@scenarioDoc` decorators\n- **`client.tsp`** (optional) — client-level customizations; takes priority over `main.tsp` during generation\n- **`tspconfig.yaml`** (optional in the Spector test project) — C#-specific generation options\n\nRead the `@scenarioDoc` decorators to understand:\n\n- The HTTP method, path, and expected parameters\n- The expected request body shape\n- The expected response status code and body\n- Any special behavior (e.g., \"should return 204\", \"should send header X\")\n\n---\n\n## Step 3 — Generate the C# client for the target spec\n\nUse `Generate.ps1` with a filter to generate only the specific spec:\n\n```powershell\ncd {PKG}\n# Generate unstubbed (for local testing\u002Fdevelopment)\npwsh eng\u002Fscripts\u002FGenerate.ps1 -filter \"\u003Cspec-path>\" -Stubbed $false\n\n# Generate stubbed (default, matches what is committed to repo)\npwsh eng\u002Fscripts\u002FGenerate.ps1 -filter \"\u003Cspec-path>\"\n```\n\nExamples:\n\n```powershell\n# Standard spec (unstubbed for testing)\npwsh eng\u002Fscripts\u002FGenerate.ps1 -filter \"http\u002Fencode\u002Fduration\" -Stubbed $false\n\n# Azure spec\npwsh eng\u002Fscripts\u002FGenerate.ps1 -filter \"http\u002Fazure\u002Fcore\u002Flro\" -Stubbed $false\n\n# Versioning spec (generates v1 + v2 automatically)\npwsh eng\u002Fscripts\u002FGenerate.ps1 -filter \"http\u002Fversioning\u002Fadded\" -Stubbed $false\n```\n\nThe generated code lands in `{PKG}\u002Fgenerator\u002FTestProjects\u002FSpector\u002F\u003Cspec-path>\u002Fsrc\u002FGenerated\u002F`.\n\n### Verify generation succeeded\n\n```powershell\n# Check that client code was generated\nGet-ChildItem \"{PKG}\u002Fgenerator\u002FTestProjects\u002FSpector\u002F\u003Cspec-path>\u002Fsrc\u002FGenerated\u002F\" -Filter \"*Client.cs\"\n```\n\n> **Note:** All committed Spector libraries are stubbed. The `[SpectorTest]` attribute automatically skips tests for stubbed clients. Use `Test-Spector.ps1` (Step 7) to regenerate unstubbed, run tests, and restore automatically.\n\n---\n\n## Step 4 — Read the generated client API surface\n\nBrowse the generated code to understand:\n\n1. **Client class(es)**: `*Client.cs` — the entry point(s)\n2. **Sub-clients**: accessed via `Get*Client()` methods\n3. **Operations**: async methods like `GetAsync()`, `PutAsync(body)`, `SendAsync()`\n4. **Models**: under `Models\u002F` — request\u002Fresponse shapes\n5. **Constructor signature**: `new XClient(Uri endpoint, XClientOptions options)` or `new XClient(Uri endpoint, KeyCredential credential, XClientOptions options)`\n\nPay attention to:\n\n- Method names (they map to TypeSpec operation names)\n- Parameter types (models, primitives, BinaryData, RequestContent)\n- Return types (`ClientResult`, `ClientResult\u003CT>`, `AsyncPageable\u003CT>`)\n- **Azure-specific patterns**: `RequestContent` usage, `Azure.Core` types, internal vs public visibility\n\n---\n\n## Step 5 — Create or extend the test file\n\n### Directory and namespace conventions\n\nThe test directory structure mirrors the spec path with these transformations:\n\n- `http\u002F` → `Http\u002F`\n- kebab-case → PascalCase (e.g., `content-negotiation` → `ContentNegotiation`)\n- `type\u002F` → `_Type\u002F` (leading underscore because `Type` is a C# keyword)\n- `array` → `_Array` (same reason)\n- `enum` → `_Enum` (same reason)\n- `azure\u002F` → `Azure\u002F` (Azure specs get their own top-level test directory)\n\n**Namespace pattern**: `TestProjects.Spector.Tests.Http.\u003CPascalCasePath>`\n\nExample mappings:\n\n| Spec path | Test directory | Namespace |\n|-----------|---------------|-----------|\n| `http\u002Fencode\u002Fduration` | `Http\u002FEncode\u002FDuration\u002F` | `TestProjects.Spector.Tests.Http.Encode.Duration` |\n| `http\u002Fazure\u002Fcore\u002Fbasic` | `Http\u002FAzure\u002FCore\u002FBasic\u002F` | `TestProjects.Spector.Tests.Http.Azure.Core.Basic` |\n| `http\u002Fazure\u002Fclient-generator-core\u002Faccess` | `Http\u002FAzure\u002FClientGeneratorCore\u002FAccess\u002F` | `TestProjects.Spector.Tests.Http.Azure.ClientGeneratorCore.Access` |\n| `http\u002Ftype\u002Funion\u002Fdiscriminated` | `Http\u002F_Type\u002FUnion\u002FDiscriminated\u002F` | `TestProjects.Spector.Tests.Http._Type.Union.Discriminated` |\n\n### Test file template\n\n```csharp\n\u002F\u002F Copyright (c) Microsoft Corporation. All rights reserved.\n\u002F\u002F Licensed under the MIT License.\n\nusing System.Threading.Tasks;\nusing \u003CGeneratedNamespace>;\nusing NUnit.Framework;\n\nnamespace TestProjects.Spector.Tests.Http.\u003CCategory>.\u003CSubCategory>\n{\n    public class \u003CName>Tests : SpectorTestBase\n    {\n        [SpectorTest]\n        public Task \u003CScenarioName>() => Test(async (host) =>\n        {\n            var response = await new \u003CClient>(host, null).\u003CMethod>Async(\u003Cargs>);\n            Assert.AreEqual(\u003CexpectedStatusCode>, response.GetRawResponse().Status);\n        });\n    }\n}\n```\n\n### Common test patterns\n\n**Simple void operation (204 response):**\n\n```csharp\n[SpectorTest]\npublic Task SimpleOp() => Test(async (host) =>\n{\n    var response = await new MyClient(host, null).DoThingAsync();\n    Assert.AreEqual(204, response.GetRawResponse().Status);\n});\n```\n\n**GET with typed response:**\n\n```csharp\n[SpectorTest]\npublic Task GetValue() => Test(async (host) =>\n{\n    var response = await new MyClient(host, null).GetValueAsync();\n    Assert.AreEqual(\"expected\", response.Value);\n});\n```\n\n**Azure RequestContent pattern (common in Azure specs):**\n\n```csharp\n[SpectorTest]\npublic Task SendAction() => Test(async (host) =>\n{\n    var value = new { stringProperty = \"text\", intProperty = 42 };\n    var response = await new MyClient(host, null)\n        .ActionAsync(\"query\", \"header\", RequestContent.Create(value));\n    Assert.AreEqual(200, response.Status);\n});\n```\n\n**Round-trip (GET then PUT):**\n\n```csharp\n[SpectorTest]\npublic Task RoundTrip() => Test(async (host) =>\n{\n    var client = new MyClient(host, null);\n    var getResult = await client.GetAsync();\n    var response = await client.PutAsync(getResult.Value);\n    Assert.AreEqual(204, response.GetRawResponse().Status);\n});\n```\n\n**Azure access\u002Fvisibility test (using reflection for internal members):**\n\n```csharp\n[SpectorTest]\npublic Task InternalOp() => Test(async (host) =>\n{\n    var client = new MyClient(host, null);\n    var internalClient = GetProperty(client, \"InternalOpClient\");\n    var response = await InvokeMethodAsync(internalClient!, \"InternalAsync\");\n    Assert.AreEqual(204, ((ClientResult)response!).GetRawResponse().Status);\n});\n```\n\n**Pagination:**\n\n```csharp\n[SpectorTest]\npublic Task ListItems() => Test(async (host) =>\n{\n    var items = new MyClient(host, null).GetItemsAsync();\n    int count = 0;\n    await foreach (var item in items)\n    {\n        count++;\n    }\n    Assert.Greater(count, 0);\n});\n```\n\n**Error assertion:**\n\n```csharp\n[SpectorTest]\npublic Task InvalidKey() => Test((host) =>\n{\n    var exception = Assert.ThrowsAsync\u003CClientResultException>(\n        () => new MyClient(host, new ApiKeyCredential(\"invalid\"), null).CallAsync());\n    Assert.AreEqual(403, exception!.Status);\n    return Task.CompletedTask;\n});\n```\n\n### Additional imports commonly needed\n\n```csharp\nusing System;\nusing System.ClientModel;           \u002F\u002F ClientResult, ClientResultException, ApiKeyCredential\nusing System.IO;                     \u002F\u002F For file\u002Fstream scenarios\nusing System.Text.Json.Nodes;       \u002F\u002F For parsing raw JSON responses\nusing Azure.Core;                    \u002F\u002F RequestContent (Azure specs)\nusing NUnit.Framework;               \u002F\u002F Test framework\n```\n\n---\n\n## Step 6 — Update the .csproj if needed\n\nIf a new Spector test project directory was created (new spec), a project reference may be needed in `TestProjects.Spector.Tests.csproj`:\n\n```xml\n\u003CProjectReference Include=\"..\\Spector\\http\\\u003Cspec-path>\\src\\\u003CProjectName>.csproj\" \u002F>\n```\n\nCheck existing references to match the pattern. The project name typically matches the `package-name` from `tspconfig.yaml` or is derived from the namespace.\n\n> Only add a project reference if one doesn't already exist for the spec.\n\n---\n\n## Step 7 — Build and run the tests\n\n### Recommended: Use Test-Spector.ps1\n\nThe `Test-Spector.ps1` script is the recommended way to test Spector specs. It automatically:\n\n1. Regenerates the spec as **unstubbed** (so tests are not auto-skipped)\n2. Runs the tests for that spec using namespace-based filtering\n3. Restores the directory to its original stubbed state\n\n```powershell\ncd {PKG}\n# Test a specific spec\npwsh eng\u002Fscripts\u002FTest-Spector.ps1 -filter \"\u003Cspec-path>\"\n```\n\nExamples:\n\n```powershell\n# Standard spec\npwsh eng\u002Fscripts\u002FTest-Spector.ps1 -filter \"http\u002Fencode\u002Fduration\"\n\n# Azure spec\npwsh eng\u002Fscripts\u002FTest-Spector.ps1 -filter \"http\u002Fazure\u002Fcore\u002Fbasic\"\n```\n\n### Run full Spector test suite\n\n```powershell\npwsh eng\u002Fscripts\u002FGet-Spector-Coverage.ps1\n```\n\nThis regenerates ALL specs, runs the full test suite, and produces a coverage file at `{PKG}\u002Fgenerator\u002Fartifacts\u002Fcoverage\u002Ftsp-spector-coverage-azure.json`.\n\n### Manual approach (if needed)\n\nIf you need more control, you can manually generate unstubbed, build, and run tests:\n\n```powershell\ncd {PKG}\n\n# Generate unstubbed\npwsh eng\u002Fscripts\u002FGenerate.ps1 -filter \"\u003Cspec-path>\" -Stubbed $false\n\n# Build\ndotnet build generator\n\n# Run only your new tests\ndotnet test generator\u002FTestProjects\u002FSpector.Tests\u002FTestProjects.Spector.Tests.csproj `\n    --filter \"FullyQualifiedName~TestProjects.Spector.Tests.Http.\u003CYourNamespace>\"\n\n# Restore the directory to stubbed state when done\ngit clean -xfd generator\u002FTestProjects\u002FSpector\u002F\u003Cspec-path>\ngit restore generator\u002FTestProjects\u002FSpector\u002F\u003Cspec-path>\n```\n\n---\n\n## Step 8 — Handle special cases\n\n### Versioning specs\n\nVersioning specs generate **two clients** (v1 and v2). Tests go in separate subdirectories:\n\n```\nHttp\u002FVersioning\u002F\u003CName>\u002FV1\u002F\u003CName>V1Tests.cs\nHttp\u002FVersioning\u002F\u003CName>\u002FV2\u002F\u003CName>V2Tests.cs\n```\n\nGeneration is handled automatically by `Generate.ps1` when the path contains `versioning`.\n\n### Srv-driven (resiliency) specs\n\nSimilar to versioning — generates v1 and v2 clients from `old.tsp` and `main.tsp`.\n\n### Specs with tspconfig.yaml\n\nSome specs have a `tspconfig.yaml` in the Spector test project that overrides the `package-name`. Check `{PKG}\u002Fgenerator\u002FTestProjects\u002FSpector\u002F\u003Cspec-path>\u002Ftspconfig.yaml` before importing the generated namespace.\n\n### Azure resource-manager specs\n\nAll `azure\u002Fresource-manager\u002F*` specs are excluded from the data-plane generator and delegated to the management generator at `eng\u002Fpackages\u002Fhttp-client-csharp-mgmt`. These are not expected to have tests in `{PKG}`.\n\n---\n\n## Coverage data flow\n\nUnderstanding how test results reach the dashboards:\n\n1. **Test execution**: `dotnet test` runs against the Spector mock server (via `@typespec\u002Fspector` CLI)\n2. **Coverage file**: The Spector server writes `tsp-spector-coverage-azure.json` to `{PKG}\u002Fgenerator\u002Fartifacts\u002Fcoverage\u002F`\n3. **CI upload**: The Azure DevOps pipeline (`archetype-typespec-emitter.yml`) uploads coverage via:\n   ```bash\n   npx tsp-spector upload-coverage \\\n     --coverageFile tsp-spector-coverage-azure.json \\\n     --generatorName @azure-typespec\u002F\u003CSpectorName> \\\n     --storageAccountName typespec \\\n     --containerName coverages \\\n     --generatorMode azure\n   ```\n4. **Dashboard rendering**: Both dashboards read from Azure Storage to display per-scenario coverage\n\n---\n\n## Notes\n\n- **Do not modify `Spector-Helper.psm1`** to remove items from the failing list unless you're sure the generator now supports them.\n- **All committed Spector libraries are stubbed** — `Generate.ps1` defaults to `$Stubbed = $true`. Use `Test-Spector.ps1` to temporarily regenerate unstubbed and run tests.\n- **Tests auto-skip** when the generated client is stubbed — it's safe to write tests for stubbed specs. They'll activate when `Test-Spector.ps1` regenerates them unstubbed.\n- Only commit: test files (`.cs`), `.csproj` changes, and `tspconfig.yaml` if needed.\n- Follow existing test naming conventions: `\u003CFeature>Tests.cs` in the matching directory.\n- Use `[SpectorTest]` attribute (not `[Test]`) for all Spector tests — it enables auto-skip for stubbed implementations.\n- All test classes must inherit from `SpectorTestBase`.\n- Do not add change logs — the http-client-csharp instructions say they are not needed.\n- Do not comment out or delete existing tests.\n- The `[SpectorTest]` attribute uses **Roslyn** to detect stubbed implementations by checking constructor syntax.\n- The `SpectorTestBase` class provides reflection helpers (`InvokeMethodAsync`, `GetProperty`, `InvokeMethod`) for testing internal\u002Fprivate members — this is especially useful for Azure specs that test access modifiers.\n","# Discovering and implementing Spector coverage gaps for the Azure C# emitter\n\n## Overview\n\nThis skill discovers which Spector scenarios the Azure C# emitter (`@azure-tools\u002Ftypespec-csharp`) does **not** yet cover, then implements the missing test(s). Spector scenarios are defined in two packages:\n\n- **Standard specs**: `@typespec\u002Fhttp-specs` — general HTTP client scenarios\n- **Azure specs**: `@azure-tools\u002Fazure-http-specs` — Azure-specific scenarios (core, LRO, paging, resource-manager, etc.)\n\nTwo coverage dashboards exist:\n\n| Dashboard | URL | Scope |\n|-----------|-----|-------|\n| **Standard** | \u003Chttps:\u002F\u002Ftypespec.io\u002Fcan-i-use\u002Fhttp\u002F> | Standard HTTP specs only |\n| **Azure** | \u003Chttps:\u002F\u002Fazure.github.io\u002Ftypespec-azure\u002Fcan-i-use\u002Fhttp\u002F> | Standard + Azure specs |\n\n> **Tip:** Comparing the two dashboards reveals Standard scenarios where the Azure emitter lags behind (or ahead of) the core TypeSpec C# emitter in `microsoft\u002Ftypespec`.\n\n> **Note:** `{PKG}` refers to `\u003Crepo-root>\u002Feng\u002Fpackages\u002Fhttp-client-csharp` throughout this document.\n\n## Inputs\n\nYou may receive one of:\n\n- **\"Find coverage gaps\"** — discover all missing scenarios and present them.\n- **\"Compare Azure vs Standard dashboards\"** — identify Standard scenarios covered on typespec.io but not on the Azure dashboard (or vice versa).\n- **Spector spec link** — a link to a specific spec under `packages\u002Fhttp-specs\u002Fspecs\u002F...` or `packages\u002Fazure-http-specs\u002Fspecs\u002F...`.\n- **Spec name** — e.g., `http\u002Fencode\u002Fduration`, `http\u002Fazure\u002Fcore\u002Flro\u002Fstandard`, `http\u002Ftype\u002Funion\u002Fdiscriminated`.\n\n## Output\n\n- A report of coverage gaps (when discovering).\n- A comparison table of Standard vs Azure dashboard coverage (when comparing).\n- New or updated C# NUnit test file(s) under `{PKG}\u002Fgenerator\u002FTestProjects\u002FSpector.Tests\u002FHttp\u002F`.\n- Updated `{PKG}\u002Fgenerator\u002FTestProjects\u002FSpector.Tests\u002FTestProjects.Spector.Tests.csproj` if a new project reference is needed.\n- Regenerated client code (via `Generate.ps1`).\n\n## Workflow\n\n- [ ] Ensure prerequisites are met (npm ci, npm run build)\n- [ ] Discover coverage gaps or identify the target spec\n- [ ] Verify the spec is not in the failing specs list\n- [ ] Generate the C# client for the target spec (unstubbed, or use Test-Spector.ps1)\n- [ ] Read the generated client to understand the API surface\n- [ ] Read the TypeSpec scenario file to understand expected behavior\n- [ ] Find or create the test file\n- [ ] Implement the test(s) following existing conventions\n- [ ] Run the tests using `Test-Spector.ps1 -filter \"\u003Cspec-path>\"`\n- [ ] Validate all tests pass\n\n---\n\n## Prerequisites — Environment setup\n\nBefore starting, ensure the build environment is ready.\n\n1. **Install dependencies** (from `{PKG}`):\n   ```powershell\n   cd {PKG}\n   npm ci\n   ```\n2. **Build the package**:\n   ```powershell\n   npm run build\n   ```\n\n> ⚠️ Do NOT run `pnpm install` or `pnpm build` at the repo root — only the http-client-csharp package build is needed.\n\n---\n\n## Step 1 — Discover coverage gaps\n\nBefore identifying missing scenarios, compare the working branch with current upstream `Azure\u002Fazure-sdk-for-net` main and check the dashboard report's generator commit and spec version. An older fork or dependency pin can make already-implemented scenarios appear missing locally.\n\n### How specs are organized\n\nThe Azure C# emitter tests specs from **two sources**:\n\n1. **Standard HTTP specs** (`@typespec\u002Fhttp-specs`): Located at `{PKG}\u002Fnode_modules\u002F@typespec\u002Fhttp-specs\u002Fspecs\u002F`\n2. **Azure HTTP specs** (`@azure-tools\u002Fazure-http-specs`): Located at `{PKG}\u002Fnode_modules\u002F@azure-tools\u002Fazure-http-specs\u002Fspecs\u002F`\n\n### How specs are filtered\n\nThe file `{PKG}\u002Feng\u002Fscripts\u002FSpector-Helper.psm1` defines which specs are included\u002Fexcluded.\n\n**Failing\u002Fexcluded specs** are defined in the `$failingSpecs` array. Always check that file for the current list — do not hardcode specs here.\n\nCurrent exclusions fall into three categories:\n\n1. **Standard spec issues**: `type\u002Ffile`\n2. **Azure specs not yet buildable**: `azure\u002Fclient-generator-core\u002Fdeserialize-empty-string-as-null`\n3. **Delegated to management generator**: All `azure\u002Fresource-manager\u002F*` specs (common-properties, non-resource, operation-templates, resources, large-header, method-subscription-id, multi-service variants)\n\n### Discovering gaps programmatically\n\nCompare available specs against existing tests. Run this from `{PKG}`:\n\n```powershell\nImport-Module \"{PKG}\u002Feng\u002Fscripts\u002FSpector-Helper.psm1\" -DisableNameChecking -Force\n\n# Get all valid specs\n$specs = Get-Sorted-Specs | ForEach-Object { Get-SubPath $_ }\n\n# Get all test files\n$testFiles = Get-ChildItem -Path \"{PKG}\u002Fgenerator\u002FTestProjects\u002FSpector.Tests\u002FHttp\" -Recurse -Filter \"*Tests.cs\" |\n    ForEach-Object { $_.FullName }\n\n# For each spec, check if a corresponding test directory\u002Ffile exists\nforeach ($spec in $specs) {\n    $specParts = $spec -replace '\u002F', '\\' -split '\\\\'\n    $testPath = \"{PKG}\u002Fgenerator\u002FTestProjects\u002FSpector.Tests\u002FHttp\"\n    # ... check if test exists\n}\n```\n\n### Comparing Azure vs Standard dashboards\n\nThe two dashboards report coverage for different scopes:\n\n- **Standard dashboard** (typespec.io): Shows coverage for `@typespec\u002Fhttp-specs` scenarios only, reported by the base `@typespec\u002Fhttp-client-csharp` emitter in the `microsoft\u002Ftypespec` repo.\n- **Azure dashboard** (azure.github.io\u002Ftypespec-azure): Shows coverage for **both** `@typespec\u002Fhttp-specs` and `@azure-tools\u002Fazure-http-specs` scenarios, reported by the `@azure-tools\u002Ftypespec-csharp` emitter in this repo.\n\n**To find gaps between the two dashboards:**\n\n1. Open both dashboards side-by-side.\n2. For each Standard scenario shown as ✅ on typespec.io but ❌\u002Fmissing on the Azure dashboard, that is a **regression or missing port** from the base emitter.\n3. For each Standard scenario shown as ❌ on typespec.io but ✅ on the Azure dashboard, that is an **Azure-only enhancement**.\n4. Azure-specific scenarios (`azure\u002F*`) only appear on the Azure dashboard.\n\nCommon causes of Standard coverage gaps in Azure:\n- The base emitter in `microsoft\u002Ftypespec` added a test that hasn't been ported here yet.\n- The Azure emitter excludes a spec (check `$failingSpecs` in `Spector-Helper.psm1`).\n- Namespace or build conflicts specific to the Azure generator (e.g., `Response` vs `Azure.Response`).\n\n### Existing test coverage\n\n**Standard spec test directories** (under `Spector.Tests\u002FHttp\u002F`):\n\n```\nAuthentication\u002F   (ApiKey, Http\u002FCustom, OAuth2, Union)\nClient\u002F           (ClientNamespace, Naming, Overload, Structure\u002F*)\nEncode\u002F           (Array, Bytes, DateTime, Duration, Numeric)\nParameters\u002F       (Basic, BodyOptionality, CollectionFormat, Path, Query, Spread)\nPayload\u002F          (ContentNegotiation, JsonMergePatch, MediaType, MultiPart, Pageable, Xml)\nResiliency\u002F       (SrvDriven\u002FV1, SrvDriven\u002FV2)\nRoutes\u002F\nSerialization\u002F    (EncodedName\u002FJson)\nServer\u002F           (Endpoint\u002FNotDefined, Path\u002FMultiple, Path\u002FSingle, Versions\u002F*)\nService\u002F\nSpecialHeaders\u002F   (ConditionalRequest, Repeatability)\nSpecialWords\u002F\nStreaming\u002F        (Jsonl, Sse, including SSE protocol metadata and explicit resumption)\nVersioning\u002F       (Added, MadeOptional, Removed, RenamedFrom, ReturnTypeChangedFrom, TypeChangedFrom)\n_Type\u002F            (Array, Dictionary, Enum\u002F*, Model\u002F*, Property\u002F*, Scalar, Union)\n```\n\n**Azure spec test directories** (under `Spector.Tests\u002FHttp\u002FAzure\u002F`):\n\n```\nClientGeneratorCore\u002F  (Access, AlternateType, ApiVersion\u002F*, ClientInitialization\u002F*, ClientLocation\u002F*, HierarchyBuilding, Override, Usage)\nCore\u002F                 (Basic, Lro\u002FRpc, Lro\u002FStandard, Model, Page, Scalar, Traits)\nEncode\u002F               (Duration)\nExample\u002F              (Basic)\nPayload\u002F              (Pageable)\nSpecialHeaders\u002F       (ClientRequestId)\nVersioning\u002F           (PreviewVersion\u002FV1, PreviewVersion\u002FV2)\n```\n\n### Accurate gap detection\n\nThe naive approach of matching spec paths to test directory names can produce false positives because:\n\n- C# reserved words get underscore-prefixed in test dirs (e.g., `type\u002F` → `_Type\u002F`, `array` → `_Array`, `enum` → `_Enum`)\n- kebab-case gets converted to PascalCase (e.g., `content-negotiation` → `ContentNegotiation`)\n- Some test files cover a parent spec but not sub-specs (e.g., `UnionTests.cs` covers `type\u002Funion` but NOT `type\u002Funion\u002Fdiscriminated`)\n- Response specs use `_Response\u002F` test namespaces and aliased project references to avoid conflicts with `Azure.Response`.\n\n**To find real gaps**, verify each candidate by checking whether a test _directory_ exists for the spec's exact path, including sub-paths. A test file at a parent level does NOT cover child specs.\n\n> **Important:** The gap list evolves over time. Always re-run the comparison to get current gaps. All committed Spector libraries are stubbed — `[SpectorTest]` will auto-skip tests unless you regenerate with `-Stubbed $false` or use `Test-Spector.ps1`.\n\n### Understanding stubbed vs unstubbed generation\n\nAll Spector libraries **committed to the repository are stubbed**. `Generate.ps1` defaults to `$Stubbed = $true`, which causes the emitter to use `AzureStubGenerator` instead of `AzureClientGenerator`. Stubbed clients use expression-bodied constructors (`=>`) instead of block bodies (`{ }`), and the `[SpectorTest]` attribute automatically skips tests for stubbed clients.\n\nTo generate **unstubbed** code (for local testing), pass `-Stubbed $false`:\n\n```powershell\npwsh eng\u002Fscripts\u002FGenerate.ps1 -filter \"\u003Cspec-path>\" -Stubbed $false\n```\n\nHowever, the recommended way to test is via `Test-Spector.ps1` (see Step 7), which handles the unstubbed regeneration, test execution, and directory restoration automatically.\n\n---\n\n## Step 2 — Read the spec to understand expected behavior\n\nSpec files live in:\n- **Standard**: `{PKG}\u002Fnode_modules\u002F@typespec\u002Fhttp-specs\u002Fspecs\u002F`\n- **Azure**: `{PKG}\u002Fnode_modules\u002F@azure-tools\u002Fazure-http-specs\u002Fspecs\u002F`\n\nIf `node_modules` is not installed, specs can also be found in the upstream repos:\n- \u003Chttps:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Ftypespec\u002Ftree\u002Fmain\u002Fpackages\u002Fhttp-specs\u002Fspecs>\n- \u003Chttps:\u002F\u002Fgithub.com\u002FAzure\u002Ftypespec-azure\u002Ftree\u002Fmain\u002Fpackages\u002Fazure-http-specs\u002Fspecs>\n\nEach spec contains:\n\n- **`main.tsp`** — the TypeSpec definition with `@scenario` and `@scenarioDoc` decorators\n- **`client.tsp`** (optional) — client-level customizations; takes priority over `main.tsp` during generation\n- **`tspconfig.yaml`** (optional in the Spector test project) — C#-specific generation options\n\nRead the `@scenarioDoc` decorators to understand:\n\n- The HTTP method, path, and expected parameters\n- The expected request body shape\n- The expected response status code and body\n- Any special behavior (e.g., \"should return 204\", \"should send header X\")\n\n---\n\n## Step 3 — Generate the C# client for the target spec\n\nUse `Generate.ps1` with a filter to generate only the specific spec:\n\n```powershell\ncd {PKG}\n# Generate unstubbed (for local testing\u002Fdevelopment)\npwsh eng\u002Fscripts\u002FGenerate.ps1 -filter \"\u003Cspec-path>\" -Stubbed $false\n\n# Generate stubbed (default, matches what is committed to repo)\npwsh eng\u002Fscripts\u002FGenerate.ps1 -filter \"\u003Cspec-path>\"\n```\n\nExamples:\n\n```powershell\n# Standard spec (unstubbed for testing)\npwsh eng\u002Fscripts\u002FGenerate.ps1 -filter \"http\u002Fencode\u002Fduration\" -Stubbed $false\n\n# Azure spec\npwsh eng\u002Fscripts\u002FGenerate.ps1 -filter \"http\u002Fazure\u002Fcore\u002Flro\" -Stubbed $false\n\n# Versioning spec (generates v1 + v2 automatically)\npwsh eng\u002Fscripts\u002FGenerate.ps1 -filter \"http\u002Fversioning\u002Fadded\" -Stubbed $false\n```\n\nThe generated code lands in `{PKG}\u002Fgenerator\u002FTestProjects\u002FSpector\u002F\u003Cspec-path>\u002Fsrc\u002FGenerated\u002F`.\n\n### Verify generation succeeded\n\n```powershell\n# Check that client code was generated\nGet-ChildItem \"{PKG}\u002Fgenerator\u002FTestProjects\u002FSpector\u002F\u003Cspec-path>\u002Fsrc\u002FGenerated\u002F\" -Filter \"*Client.cs\"\n```\n\n> **Note:** All committed Spector libraries are stubbed. The `[SpectorTest]` attribute automatically skips tests for stubbed clients. Use `Test-Spector.ps1` (Step 7) to regenerate unstubbed, run tests, and restore automatically.\n\n---\n\n## Step 4 — Read the generated client API surface\n\nBrowse the generated code to understand:\n\n1. **Client class(es)**: `*Client.cs` — the entry point(s)\n2. **Sub-clients**: accessed via `Get*Client()` methods\n3. **Operations**: async methods like `GetAsync()`, `PutAsync(body)`, `SendAsync()`\n4. **Models**: under `Models\u002F` — request\u002Fresponse shapes\n5. **Constructor signature**: `new XClient(Uri endpoint, XClientOptions options)` or `new XClient(Uri endpoint, KeyCredential credential, XClientOptions options)`\n\nPay attention to:\n\n- Method names (they map to TypeSpec operation names)\n- Parameter types (models, primitives, BinaryData, RequestContent)\n- Return types (`ClientResult`, `ClientResult\u003CT>`, `AsyncPageable\u003CT>`)\n- **Azure-specific patterns**: `RequestContent` usage, `Azure.Core` types, internal vs public visibility\n\n---\n\n## Step 5 — Create or extend the test file\n\n### Directory and namespace conventions\n\nThe test directory structure mirrors the spec path with these transformations:\n\n- `http\u002F` → `Http\u002F`\n- kebab-case → PascalCase (e.g., `content-negotiation` → `ContentNegotiation`)\n- `type\u002F` → `_Type\u002F` (leading underscore because `Type` is a C# keyword)\n- `array` → `_Array` (same reason)\n- `enum` → `_Enum` (same reason)\n- `azure\u002F` → `Azure\u002F` (Azure specs get their own top-level test directory)\n\n**Namespace pattern**: `TestProjects.Spector.Tests.Http.\u003CPascalCasePath>`\n\nExample mappings:\n\n| Spec path | Test directory | Namespace |\n|-----------|---------------|-----------|\n| `http\u002Fencode\u002Fduration` | `Http\u002FEncode\u002FDuration\u002F` | `TestProjects.Spector.Tests.Http.Encode.Duration` |\n| `http\u002Fazure\u002Fcore\u002Fbasic` | `Http\u002FAzure\u002FCore\u002FBasic\u002F` | `TestProjects.Spector.Tests.Http.Azure.Core.Basic` |\n| `http\u002Fazure\u002Fclient-generator-core\u002Faccess` | `Http\u002FAzure\u002FClientGeneratorCore\u002FAccess\u002F` | `TestProjects.Spector.Tests.Http.Azure.ClientGeneratorCore.Access` |\n| `http\u002Ftype\u002Funion\u002Fdiscriminated` | `Http\u002F_Type\u002FUnion\u002FDiscriminated\u002F` | `TestProjects.Spector.Tests.Http._Type.Union.Discriminated` |\n\n### Test file template\n\n```csharp\n\u002F\u002F Copyright (c) Microsoft Corporation. All rights reserved.\n\u002F\u002F Licensed under the MIT License.\n\nusing System.Threading.Tasks;\nusing \u003CGeneratedNamespace>;\nusing NUnit.Framework;\n\nnamespace TestProjects.Spector.Tests.Http.\u003CCategory>.\u003CSubCategory>\n{\n    public class \u003CName>Tests : SpectorTestBase\n    {\n        [SpectorTest]\n        public Task \u003CScenarioName>() => Test(async (host) =>\n        {\n            var response = await new \u003CClient>(host, null).\u003CMethod>Async(\u003Cargs>);\n            Assert.AreEqual(\u003CexpectedStatusCode>, response.GetRawResponse().Status);\n        });\n    }\n}\n```\n\n### Common test patterns\n\n**Simple void operation (204 response):**\n\n```csharp\n[SpectorTest]\npublic Task SimpleOp() => Test(async (host) =>\n{\n    var response = await new MyClient(host, null).DoThingAsync();\n    Assert.AreEqual(204, response.GetRawResponse().Status);\n});\n```\n\n**GET with typed response:**\n\n```csharp\n[SpectorTest]\npublic Task GetValue() => Test(async (host) =>\n{\n    var response = await new MyClient(host, null).GetValueAsync();\n    Assert.AreEqual(\"expected\", response.Value);\n});\n```\n\n**Azure RequestContent pattern (common in Azure specs):**\n\n```csharp\n[SpectorTest]\npublic Task SendAction() => Test(async (host) =>\n{\n    var value = new { stringProperty = \"text\", intProperty = 42 };\n    var response = await new MyClient(host, null)\n        .ActionAsync(\"query\", \"header\", RequestContent.Create(value));\n    Assert.AreEqual(200, response.Status);\n});\n```\n\n**Round-trip (GET then PUT):**\n\n```csharp\n[SpectorTest]\npublic Task RoundTrip() => Test(async (host) =>\n{\n    var client = new MyClient(host, null);\n    var getResult = await client.GetAsync();\n    var response = await client.PutAsync(getResult.Value);\n    Assert.AreEqual(204, response.GetRawResponse().Status);\n});\n```\n\n**Azure access\u002Fvisibility test (using reflection for internal members):**\n\n```csharp\n[SpectorTest]\npublic Task InternalOp() => Test(async (host) =>\n{\n    var client = new MyClient(host, null);\n    var internalClient = GetProperty(client, \"InternalOpClient\");\n    var response = await InvokeMethodAsync(internalClient!, \"InternalAsync\");\n    Assert.AreEqual(204, ((ClientResult)response!).GetRawResponse().Status);\n});\n```\n\n**Pagination:**\n\n```csharp\n[SpectorTest]\npublic Task ListItems() => Test(async (host) =>\n{\n    var items = new MyClient(host, null).GetItemsAsync();\n    int count = 0;\n    await foreach (var item in items)\n    {\n        count++;\n    }\n    Assert.Greater(count, 0);\n});\n```\n\n**Error assertion:**\n\n```csharp\n[SpectorTest]\npublic Task InvalidKey() => Test((host) =>\n{\n    var exception = Assert.ThrowsAsync\u003CClientResultException>(\n        () => new MyClient(host, new ApiKeyCredential(\"invalid\"), null).CallAsync());\n    Assert.AreEqual(403, exception!.Status);\n    return Task.CompletedTask;\n});\n```\n\n### Additional imports commonly needed\n\n```csharp\nusing System;\nusing System.ClientModel;           \u002F\u002F ClientResult, ClientResultException, ApiKeyCredential\nusing System.IO;                     \u002F\u002F For file\u002Fstream scenarios\nusing System.Text.Json.Nodes;       \u002F\u002F For parsing raw JSON responses\nusing Azure.Core;                    \u002F\u002F RequestContent (Azure specs)\nusing NUnit.Framework;               \u002F\u002F Test framework\n```\n\n---\n\n## Step 6 — Update the .csproj if needed\n\nIf a new Spector test project directory was created (new spec), a project reference may be needed in `TestProjects.Spector.Tests.csproj`:\n\n```xml\n\u003CProjectReference Include=\"..\\Spector\\http\\\u003Cspec-path>\\src\\\u003CProjectName>.csproj\" \u002F>\n```\n\nCheck existing references to match the pattern. The project name typically matches the `package-name` from `tspconfig.yaml` or is derived from the namespace.\n\n> Only add a project reference if one doesn't already exist for the spec.\n\n---\n\n## Step 7 — Build and run the tests\n\n### Recommended: Use Test-Spector.ps1\n\nThe `Test-Spector.ps1` script is the recommended way to test Spector specs. It automatically:\n\n1. Regenerates the spec as **unstubbed** (so tests are not auto-skipped)\n2. Runs the tests for that spec using namespace-based filtering\n3. Restores the directory to its original stubbed state\n\n```powershell\ncd {PKG}\n# Test a specific spec\npwsh eng\u002Fscripts\u002FTest-Spector.ps1 -filter \"\u003Cspec-path>\"\n```\n\nExamples:\n\n```powershell\n# Standard spec\npwsh eng\u002Fscripts\u002FTest-Spector.ps1 -filter \"http\u002Fencode\u002Fduration\"\n\n# Azure spec\npwsh eng\u002Fscripts\u002FTest-Spector.ps1 -filter \"http\u002Fazure\u002Fcore\u002Fbasic\"\n```\n\n### Run full Spector test suite\n\n```powershell\npwsh eng\u002Fscripts\u002FGet-Spector-Coverage.ps1\n```\n\nThis regenerates ALL specs, runs the full test suite, and produces a coverage file at `{PKG}\u002Fgenerator\u002Fartifacts\u002Fcoverage\u002Ftsp-spector-coverage-azure.json`.\n\n### Manual approach (if needed)\n\nIf you need more control, you can manually generate unstubbed, build, and run tests:\n\n```powershell\ncd {PKG}\n\n# Generate unstubbed\npwsh eng\u002Fscripts\u002FGenerate.ps1 -filter \"\u003Cspec-path>\" -Stubbed $false\n\n# Build\ndotnet build generator\n\n# Run only your new tests\ndotnet test generator\u002FTestProjects\u002FSpector.Tests\u002FTestProjects.Spector.Tests.csproj `\n    --filter \"FullyQualifiedName~TestProjects.Spector.Tests.Http.\u003CYourNamespace>\"\n\n# Restore the directory to stubbed state when done\ngit clean -xfd generator\u002FTestProjects\u002FSpector\u002F\u003Cspec-path>\ngit restore generator\u002FTestProjects\u002FSpector\u002F\u003Cspec-path>\n```\n\n---\n\n## Step 8 — Handle special cases\n\n### Versioning specs\n\nVersioning specs generate **two clients** (v1 and v2). Tests go in separate subdirectories:\n\n```\nHttp\u002FVersioning\u002F\u003CName>\u002FV1\u002F\u003CName>V1Tests.cs\nHttp\u002FVersioning\u002F\u003CName>\u002FV2\u002F\u003CName>V2Tests.cs\n```\n\nGeneration is handled automatically by `Generate.ps1` when the path contains `versioning`.\n\n### Srv-driven (resiliency) specs\n\nSimilar to versioning — generates v1 and v2 clients from `old.tsp` and `main.tsp`.\n\n### Specs with tspconfig.yaml\n\nSome specs have a `tspconfig.yaml` in the Spector test project that overrides the `package-name`. Check `{PKG}\u002Fgenerator\u002FTestProjects\u002FSpector\u002F\u003Cspec-path>\u002Ftspconfig.yaml` before importing the generated namespace.\n\n### Azure resource-manager specs\n\nAll `azure\u002Fresource-manager\u002F*` specs are excluded from the data-plane generator and delegated to the management generator at `eng\u002Fpackages\u002Fhttp-client-csharp-mgmt`. These are not expected to have tests in `{PKG}`.\n\n---\n\n## Coverage data flow\n\nUnderstanding how test results reach the dashboards:\n\n1. **Test execution**: `dotnet test` runs against the Spector mock server (via `@typespec\u002Fspector` CLI)\n2. **Coverage file**: The Spector server writes `tsp-spector-coverage-azure.json` to `{PKG}\u002Fgenerator\u002Fartifacts\u002Fcoverage\u002F`\n3. **CI upload**: The Azure DevOps pipeline (`archetype-typespec-emitter.yml`) uploads coverage via:\n   ```bash\n   npx tsp-spector upload-coverage \\\n     --coverageFile tsp-spector-coverage-azure.json \\\n     --generatorName @azure-typespec\u002F\u003CSpectorName> \\\n     --storageAccountName typespec \\\n     --containerName coverages \\\n     --generatorMode azure\n   ```\n4. **Dashboard rendering**: Both dashboards read from Azure Storage to display per-scenario coverage\n\n---\n\n## Notes\n\n- **Do not modify `Spector-Helper.psm1`** to remove items from the failing list unless you're sure the generator now supports them.\n- **All committed Spector libraries are stubbed** — `Generate.ps1` defaults to `$Stubbed = $true`. Use `Test-Spector.ps1` to temporarily regenerate unstubbed and run tests.\n- **Tests auto-skip** when the generated client is stubbed — it's safe to write tests for stubbed specs. They'll activate when `Test-Spector.ps1` regenerates them unstubbed.\n- Only commit: test files (`.cs`), `.csproj` changes, and `tspconfig.yaml` if needed.\n- Follow existing test naming conventions: `\u003CFeature>Tests.cs` in the matching directory.\n- Use `[SpectorTest]` attribute (not `[Test]`) for all Spector tests — it enables auto-skip for stubbed implementations.\n- All test classes must inherit from `SpectorTestBase`.\n- Do not add change logs — the http-client-csharp instructions say they are not needed.\n- Do not comment out or delete existing tests.\n- The `[SpectorTest]` attribute uses **Roslyn** to detect stubbed implementations by checking constructor syntax.\n- The `SpectorTestBase` class provides reflection helpers (`InvokeMethodAsync`, `GetProperty`, `InvokeMethod`) for testing internal\u002Fprivate members — this is especially useful for Azure specs that test access modifiers.\n",{"name":5,"description":7},"main","dbc5eb654c3492137a4fbeeb6776c804f0042063",".github\u002Fskills\u002Fcsharp-azure-spector-coverage-gaps",5228,"https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-net","https:\u002F\u002Fgithub.com\u002FAzure","https:\u002F\u002Fdocs.microsoft.com\u002Fen-us\u002Fazure\u002F","APIs, SDKs and open source projects from Microsoft Azure","2026-11-14 22:39:26",{"source":9,"skillName":5,"commands":68,"prompt":78,"zipAvailable":79},[69,72,75],{"tool":70,"command":71},"npx","npx skills add Azure\u002Fazure-sdk-for-net --skill csharp-azure-spector-coverage-gaps",{"tool":73,"command":74},"bunx","bunx skills add Azure\u002Fazure-sdk-for-net --skill csharp-azure-spector-coverage-gaps",{"tool":76,"command":77},"pnpm","pnpm dlx skills add Azure\u002Fazure-sdk-for-net --skill csharp-azure-spector-coverage-gaps","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-net\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fcsharp-azure-spector-coverage-gaps\u002FSKILL.md",true,[],[82,106,140,167,192,215],{"skillNo":83,"name":84,"nameZh":85,"description":86,"descriptionZh":87,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":88,"categories":89,"keywords":96,"publishedAt":53},"01M6BTE1QTJPYDAN115GS2EHDQ","update-chat-api","WebPubSub Chat API 基线维护","Use when: updating, exporting, refreshing, or validating the public API baseline for Azure.Messaging.WebPubSub.Chat after a public API change.","使用场景：在公共 API 发生变更后，更新、导出、刷新或验证 Azure.Messaging.WebPubSub.Chat 的公共 API 基线。","https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-net\u002Fblob\u002Fmain\u002Fsdk\u002Fwebpubsub\u002F.github\u002Fskills\u002Fupdate-chat-api\u002FSKILL.md",[90,93],{"categoryNo":91,"categoryName":92,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQ6TQZN6R52WBJ9H8NRMQM","软件开发工程师",{"categoryNo":94,"categoryName":95,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BT7QVANT4709358VEJK53E","代码实现",[97,98,99,100,101,32,102,103,104,46,105,40,37],"update","api","update chat api","chat","change","messaging","baseline","public","public api",{"skillNo":107,"name":108,"nameZh":109,"description":110,"descriptionZh":111,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":112,"categories":113,"keywords":118,"publishedAt":53},"01M6BTDYJS2RSGZR2T2BTJJ6YC","search-documents","Azure 搜索文档 SDK 端到端工作流","E2E workflow skill for Azure.Search.Documents SDK (TypeSpec + heavy customization). Handles full release cycles and partial updates: SHA update; code generation; build; customization fixes; ServiceVersion sync; testing; API export; changelog; version; samples; formatting; release metadata. WHEN: create new package version for Azure.Search.Documents; regenerate Azure.Search.Documents; fix Azure.Search.Documents bug; release Azure.Search.Documents; update Azure.Search.Documents spec. Do not use for Azure.ResourceManager.Search or Azure.Provisioning.Search.","Azure.Search.Documents SDK 的端到端（E2E）工作流技能（TypeSpec + 大量定制）。处理完整发布周期和部分更新：SHA 更新；代码生成；构建；定制修复；ServiceVersion 同步；测试；API 导出；变更日志；版本；示例；格式化；发布元数据。使用场景：为 Azure.Search.Documents 创建新包版本；重新生成 Azure.Search.Documents；修复 Azure.Search.Documents 错误；发布 Azure.Search.Documents；更新 Azure.Search.Documents 规范。不适用于 Azure.ResourceManager.Search 或 Azure.Provisioning.Search。","https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-net\u002Fblob\u002Fmain\u002Fsdk\u002Fsearch\u002FAzure.Search.Documents\u002F.github\u002Fskills\u002Fsearch-documents\u002FSKILL.md",[114,115],{"categoryNo":91,"categoryName":92,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":116,"categoryName":117,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8C6RHQSB2BGY8CHB7AN49N9","Microsoft 应用生命周期管理",[119,120,121,122,38,123,124,125,32,48,126,97,127,128,129,130,131,132,133,98,134,135,136,137,138,37,139],"documents","search","search documents","testing","sdk","workflow","sync","create","code","release","changelog","package","Code Generation","e2e","provisioning","fix","bug","workflow skill","updates","new package","new",{"skillNo":141,"name":142,"nameZh":143,"description":144,"descriptionZh":145,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":146,"categories":147,"keywords":150,"publishedAt":53},"01M6BTDVJGZ0N7F7DXR5Z7E0QH","search-documents-version-diff","Search.Documents 版本差异检测","Diff the current Azure.Search.Documents public API surface against a previous published version and detect preview-to-preview regressions where the SDK customization layer was not bubbled up after a TypeSpec change. Use whenever the user asks to compare Azure.Search.Documents betas, verify no Azure.Search.Documents preview features dropped, regression audit between Azure.Search.Documents versions, sanity-check a release branch for Azure.Search.Documents, or investigate a missing Azure.Search.Documents preview feature — even if they don't say the word \"diff\". Specifically catches dropped wrappers (QueryAnswer\u002FQueryCaption\u002FQueryRewrites style), lost SearchOptions aggregator redirectors, `@@access(\"internal\")` flips, deleted-instead-of-gated `#if AZURE_SEARCH_PREVIEW` blocks, dropped `ServiceVersion` enum values, and convenience-to-protocol downgrades.","将当前 Azure.Search.Documents 公共 API 接口与之前发布的版本进行对比，检测因 TypeSpec 变更后 SDK 自定义层未向上传播而导致的预览版之间的回归。当用户要求比较 Azure.Search.Documents 各 beta 版本、确认 Azure.Search.Documents 预览功能未丢失、审计 Azure.Search.Documents 各版本间的回归、对 Azure.Search.Documents 发布分支进行健全性检查，或排查 Azure.Search.Documents 预览功能缺失时使用——即使用户没有提到“diff”一词。专门捕获丢失的包装器（QueryAnswer\u002FQueryCaption\u002FQueryRewrites 类型）、丢失的 SearchOptions 聚合重定向器、`@@access(\"internal\")` 翻转、被直接删除而非通过条件门控的 `#if AZURE_SEARCH_PREVIEW` 代码块、丢失的 `ServiceVersion` 枚举值，以及便捷方法降级为协议方法等问题。","https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-net\u002Fblob\u002Fmain\u002Fsdk\u002Fsearch\u002FAzure.Search.Documents\u002F.github\u002Fskills\u002Fsearch-documents-version-diff\u002FSKILL.md",[148,149],{"categoryNo":91,"categoryName":92,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},[119,120,151,121,152,153,123,101,32,48,128,154,155,98,156,157,158,159,160,161,162,163,105,164,165,166],"search documents version diff","version","diff","protocol","audit","verify","investigate","access","regression","branch","up","preview","aggregator","sanity","layer","features",{"skillNo":168,"name":169,"nameZh":170,"description":171,"descriptionZh":172,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":173,"categories":174,"keywords":177,"publishedAt":53},"01M6BTDRCG0SXKPKCFWR75FY8T","search-documents-typespec-validation","Search.Documents TypeSpec 一致性验证","TypeSpec validation skill for Azure.Search.Documents SDK. Performs a COMPLETE validation of ALL operations, ALL models, ALL enums, and ALL properties against the TypeSpec definition at any pinned commit. Works for any API version. Generates a full gap report: missing features, extra features, naming mismatches, and recommended fix location. WHEN: \"validate Azure.Search.Documents SDK against TypeSpec\", \"detect Azure.Search.Documents typespec feature gaps\", \"what is missing from the Azure.Search.Documents SDK\", \"compare Azure.Search.Documents SDK to spec\", \"full spec coverage audit for Azure.Search.Documents\". Do NOT use for version-to-version diff or regression detection — use search-documents-version-diff instead.","面向 Azure.Search.Documents SDK 的 TypeSpec 验证技能。针对任意固定 commit 的 TypeSpec 定义，对全部操作、全部模型、全部枚举和全部属性执行完整验证。适用于任何 API 版本。生成完整的差距报告：缺失功能、多余功能、命名不匹配以及建议的修复位置。适用场景：“根据 TypeSpec 验证 Azure.Search.Documents SDK”、“检测 Azure.Search.Documents TypeSpec 功能差距”、“Azure.Search.Documents SDK 缺少哪些功能”、“将 Azure.Search.Documents SDK 与规范对比”、“对 Azure.Search.Documents 进行完整的规范覆盖审计”。请勿用于版本间差异对比或回归检测——此类情况请使用 search-documents-version-diff。","https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-net\u002Fblob\u002Fmain\u002Fsdk\u002Fsearch\u002FAzure.Search.Documents\u002F.github\u002Fskills\u002Fsearch-documents-typespec-validation\u002FSKILL.md",[175,176],{"categoryNo":91,"categoryName":92,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},[119,48,178,120,179,121,38,123,180,181,182,183,32,184,155,185,98,159,186,36,134,187,188,189,166,190,191,37],"validation","search documents typespec validation","to spec","commit","validate","gap report","report","detection","extra","do","full","at","api version","definition",{"skillNo":193,"name":194,"nameZh":195,"description":196,"descriptionZh":197,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":198,"categories":199,"keywords":206,"publishedAt":53},"01M6BTDP9JS9KNT1H9ED8AGZF5","test-skill_file","掷骰子技能文件测试","Roll dice using a random number generator.","使用随机数生成器掷骰子。","https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-net\u002Fblob\u002Fmain\u002Fsdk\u002Fai\u002FAzure.AI.Projects.Agents\u002Ftests\u002FTestData\u002Froll-dice\u002FSKILL.md",[200,203],{"categoryNo":201,"categoryName":202,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BS5011KJDVSRXG1DC4P666","普通用户",{"categoryNo":204,"categoryName":205,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8C9521NCBJVNZKB553TX3WK","抽奖活动与随机抽取",[50,207,208,209,210,211,212,213,214],"Test Skill","file","test skill file","roll dice","dice","random","generator","number",{"skillNo":216,"name":217,"nameZh":218,"description":219,"descriptionZh":220,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":221,"categories":222,"keywords":225,"publishedAt":53},"01M6BTDMF2VK2CM53SSHZNWX7T","roll-dice","随机数掷骰子","Roll dice using a random number generator. Use when asked to roll a die (d6, d20, etc.), roll dice, or generate a random dice roll.","使用随机数生成器掷骰子。当用户要求掷单个骰子（d6、d20 等）、掷骰子或生成随机掷骰结果时使用。","https:\u002F\u002Fgithub.com\u002FAzure\u002Fazure-sdk-for-net\u002Fblob\u002Fmain\u002Fsdk\u002Fai\u002FAzure.AI.Projects.Agents\u002Ftests\u002FSamples\u002Froll-dice\u002FSKILL.md",[223,224],{"categoryNo":201,"categoryName":202,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":204,"categoryName":205,"taxonomyType":28,"taxonomyTypeDesc":29},[210,211,226,46,212,213,214,37],"generate"]