Skip to content

Add missing Spector scenario test coverage for C# emitter#9962

Merged
JoshLove-msft merged 4 commits into
mainfrom
copilot/implement-missing-spector-scenarios
Mar 24, 2026
Merged

Add missing Spector scenario test coverage for C# emitter#9962
JoshLove-msft merged 4 commits into
mainfrom
copilot/implement-missing-spector-scenarios

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 7, 2026

Several Spector scenarios had no corresponding NUnit test methods in the C# emitter test suite, leaving coverage gaps that would go undetected. Scoped to XML, Special Words, and Additional Properties specs only — other gaps (Routes, Multipart) require design work.

New tests added (5 total)

SpecialWords — ModelProperties (2)

  • ModelProperties_DictMethodsAsync — dict method names as model properties
  • ModelProperties_WithListAsynclist as a model property name

Payload/Xml (1)

  • GetXmlErrorValue — verifies a ClientResultException with status 400 on the error endpoint

Type/Property/AdditionalProperties (2)

  • SpreadRecordNonDiscriminatedUnion3Get/Put — additional properties typed as WidgetData2[] | WidgetData1; get-side parses the JSON array via JsonDocument, put-side writes the array as raw BinaryData
Original prompt

This section details on the original issue you should resolve

<issue_title>Implement missing spector scenarios for csharp emitter</issue_title>
<issue_description></issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service Bot added the emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp label Mar 7, 2026
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement missing spector scenarios for C# emitter Add missing Spector scenario test coverage for C# emitter Mar 7, 2026
@JoshLove-msft
Copy link
Copy Markdown
Contributor

@copilot merge from main.
I think the only gaps are the XML, Special Words, and Additional Properties specs. The others require design work.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 24, 2026

@copilot merge from main.
I think the only gaps are the XML, Special Words, and Additional Properties specs. The others require design work.

Merged from main and scoped the PR to only the XML, Special Words, and Additional Properties specs. Removed the Routes and Multipart tests that require design work. Merge conflict in XmlTests.cs resolved (kept both main's new Enum/Datetime tests and our GetXmlErrorValue test). Commit: 1f7f197.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Mar 24, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/http-client-csharp@9962

commit: 1f7f197

@JoshLove-msft JoshLove-msft added this pull request to the merge queue Mar 24, 2026
Merged via the queue into main with commit 4864aa3 Mar 24, 2026
25 checks passed
@JoshLove-msft JoshLove-msft deleted the copilot/implement-missing-spector-scenarios branch March 24, 2026 18:52
msyyc pushed a commit that referenced this pull request Apr 1, 2026
Several Spector scenarios had no corresponding NUnit test methods in the
C# emitter test suite, leaving coverage gaps that would go undetected.
Scoped to XML, Special Words, and Additional Properties specs only —
other gaps (Routes, Multipart) require design work.

## New tests added (5 total)

### `SpecialWords` — ModelProperties (2)
- `ModelProperties_DictMethodsAsync` — dict method names as model
properties
- `ModelProperties_WithListAsync` — `list` as a model property name

### `Payload/Xml` (1)
- `GetXmlErrorValue` — verifies a `ClientResultException` with status
400 on the error endpoint

### `Type/Property/AdditionalProperties` (2)
- `SpreadRecordNonDiscriminatedUnion3Get/Put` — additional properties
typed as `WidgetData2[] | WidgetData1`; get-side parses the JSON array
via `JsonDocument`, put-side writes the array as raw `BinaryData`

<!-- START COPILOT ORIGINAL PROMPT -->



<details>

<summary>Original prompt</summary>

> 
> ----
> 
> *This section details on the original issue you should resolve*
> 
> <issue_title>Implement missing spector scenarios for csharp
emitter</issue_title>
> <issue_description></issue_description>
> 
> ## Comments on the Issue (you are @copilot in this section)
> 
> <comments>
> </comments>
> 


</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

- Fixes #9961

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement missing spector scenarios for csharp emitter

3 participants