Skip to content

Add serialization roundtrip tests for all Protocol namespace types#1289

Merged
stephentoub merged 9 commits intomainfrom
copilot/add-type-name-tests
Feb 17, 2026
Merged

Add serialization roundtrip tests for all Protocol namespace types#1289
stephentoub merged 9 commits intomainfrom
copilot/add-type-name-tests

Conversation

Copy link
Contributor

Copilot AI commented Feb 16, 2026

  • Analyze all public types in the Protocol namespace
  • Identify which types already have comprehensive test coverage
  • Create test files for all uncovered Protocol types
  • Build succeeds with 0 warnings, 0 errors
  • All 383 Protocol tests pass across net8.0, net9.0, net10.0
  • Address review feedback:
    • Strengthen Meta/JsonObject assertions to validate contents, not just NotNull
    • Move Tool InputSchema tests from ProtocolTypeTests.cs → ToolTests.cs
    • Move type-specific tests from McpTaskTests.cs into dedicated files:
      • McpTaskStatusNotificationParamsTests.cs
      • GetTaskRequestParamsTests.cs
      • GetTaskResultTests.cs
      • CancelMcpTaskRequestParamsTests.cs
      • CancelMcpTaskResultTests.cs
      • ListTasksRequestParamsTests.cs
      • ListTasksResultTests.cs
      • GetTaskPayloadRequestParamsTests.cs
      • McpTasksCapabilityTests.cs
      • RequestMcpTasksCapabilityTests.cs
      • McpTaskMetadataTests.cs

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 6 commits February 16, 2026 15:28
Add test files for Annotations, Argument, CallToolRequestParams,
CallToolResult, CancelledNotificationParams, ClientCapabilities,
CompleteRequestParams, CompleteResult, Completion, and ElicitResult.

Each test file covers full property round-trip serialization including
inherited base class properties (Meta, NextCursor, Cursor) and minimal
property scenarios.

Co-authored-by: Copilot <[email protected]>
Add 10 test files covering serialization round-trip for:
- ElicitRequestParams
- GetPromptRequestParams
- GetPromptResult
- InitializeRequestParams
- InitializeResult
- JsonRpcError
- ListPromptsResult
- ListResourcesResult
- ListResourceTemplatesResult
- ListRootsResult

Co-authored-by: Copilot <[email protected]>
Add test coverage for ListToolsResult, LoggingMessageNotificationParams,
ModelPreferences, ModelHint, PromptArgument, PromptMessage,
ReadResourceRequestParams, ReadResourceResult, ResourceTemplate,
ResourceUpdatedNotificationParams, and Root protocol types.

Each test file covers round-trip serialization with both full and minimal
property sets, including inherited base class properties.

Co-authored-by: Copilot <[email protected]>
Add 8 new test files for protocol type serialization:
- ServerCapabilitiesTests.cs
- SetLevelRequestParamsTests.cs
- SubscribeRequestParamsTests.cs
- ToolAnnotationsTests.cs
- UnsubscribeRequestParamsTests.cs
- UrlElicitationRequiredErrorDataTests.cs
- CreateTaskResultTests.cs
- ElicitationCompleteNotificationParamsTests.cs

Co-authored-by: Copilot <[email protected]>
Add 10 new test files covering CompleteContext, ListPromptsRequestParams,
ListResourcesRequestParams, ListResourceTemplatesRequestParams,
ListToolsRequestParams, ListRootsRequestParams, PingRequestParams,
PingResult, EmptyResult, and InitializedNotificationParams.

Co-authored-by: Copilot <[email protected]>
…lity types

Add 10 new test files covering serialization for:
- ResourceListChangedNotificationParams
- RootsListChangedNotificationParams
- PromptListChangedNotificationParams
- ToolListChangedNotificationParams
- SamplingCapability
- RootsCapability
- PromptsCapability
- ResourcesCapability
- ToolsCapability
- ElicitationCapability

Co-authored-by: Copilot <[email protected]>
Copilot AI changed the title [WIP] Add tests for all public types in protocols namespace Add serialization roundtrip tests for all Protocol namespace types Feb 16, 2026
Copilot AI requested a review from stephentoub February 16, 2026 16:03
Copy link
Contributor

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot if there are existing tests specific to the types these new test files are associated with, those tests should be moved to the right file

Copilot AI and others added 2 commits February 17, 2026 00:03
- Move Tool InputSchema tests from ProtocolTypeTests.cs to ToolTests.cs
- Move McpTask sub-type tests from McpTaskTests.cs into 11 new dedicated files:
  McpTaskStatusNotificationParamsTests, GetTaskRequestParamsTests,
  GetTaskResultTests, CancelMcpTaskRequestParamsTests, CancelMcpTaskResultTests,
  ListTasksRequestParamsTests, ListTasksResultTests, GetTaskPayloadRequestParamsTests,
  McpTasksCapabilityTests, RequestMcpTasksCapabilityTests, McpTaskMetadataTests

Co-authored-by: Copilot <[email protected]>
Replace weak Assert.NotNull(deserialized.Meta) assertions with proper
content validation in all 40 Protocol test files. Each assertion now
verifies the actual key-value pair set in the test's Meta property.

Co-authored-by: Copilot <[email protected]>
Copy link
Contributor Author

Copilot AI commented Feb 17, 2026

@copilot if there are existing tests specific to the types these new test files are associated with, those tests should be moved to the right file

Done in 7fcde12. Moved Tool InputSchema tests from ProtocolTypeTests.csToolTests.cs, and extracted 11 type-specific test groups from McpTaskTests.cs into their own dedicated files (McpTaskStatusNotificationParamsTests.cs, GetTaskRequestParamsTests.cs, GetTaskResultTests.cs, CancelMcpTaskRequestParamsTests.cs, CancelMcpTaskResultTests.cs, ListTasksRequestParamsTests.cs, ListTasksResultTests.cs, GetTaskPayloadRequestParamsTests.cs, McpTasksCapabilityTests.cs, RequestMcpTasksCapabilityTests.cs, McpTaskMetadataTests.cs).

Copilot AI requested a review from stephentoub February 17, 2026 00:14
@stephentoub stephentoub marked this pull request as ready for review February 17, 2026 00:17
@stephentoub stephentoub enabled auto-merge (squash) February 17, 2026 00:17
@stephentoub stephentoub merged commit 4cef394 into main Feb 17, 2026
22 of 24 checks passed
@stephentoub stephentoub deleted the copilot/add-type-name-tests branch February 17, 2026 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants