Commit 27badfe
Consolidate and tighten MRTR test coverage
Refactor MRTR tests to provide extensive coverage with less code, making
it easy for reviewers and other SDK implementers to see edge case
coverage at a glance.
Test consolidation:
- Move MRTR tests into MapMcpTests.Mrtr.cs partial class, which runs
every test across StreamableHttp, SSE, and Stateless transports
- Use Theory tests with (experimentalServer, experimentalClient) bools
to cover all 4 MRTR/backcompat protocol combinations
- Delete MrtrBackcompatTests.cs, StatelessMrtrTests.cs, and
StreamableHttpMrtrTests.cs (coverage subsumed by MapMcpTests)
- Reduce MrtrLowLevelApiTests.cs and MrtrProtocolTests.cs to unique
protocol-level tests not covered by McpClient-based tests
- Update MrtrIntegrationTests doc to reflect edge-case focus and add
simple happy-path smoke test for reviewer reference
Test improvements:
- Add ServerMessageTracker with AssertMrtrUsed()/AssertMrtrNotUsed()
to verify correct protocol mode in every test
- Add NegotiatedProtocolVersion assertions to verify negotiation
- Add result.IsError checks on all success-path tool results
- Add ErrorCode assertions on all error-path tests
- Tighten all version assertions to exact values (no NotEqual)
Helpers:
- ConnectAsync takes Action<McpClientOptions>? to prevent bypassing
transport config (path/TransportMode defaults)
- ConfigureExperimentalServer/ConfigureDefaultServer with distinct
Implementation names for clear test output
- ConfigureMrtrHandlers configures elicitation, sampling, and roots
handlers on an existing McpClientOptions object
- ConnectExperimentalAsync/ConnectDefaultAsync for common patterns
- Move EnablePollingAsync stateless test to MapMcpStatelessTests
- Add client-side warnings for legacy requests on MRTR sessions and
IncompleteResult on non-MRTR sessions
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 1fff8c5 commit 27badfe
File tree
16 files changed
+1285
-3162
lines changed- src/ModelContextProtocol.Core
- Client
- tests
- ModelContextProtocol.AspNetCore.Tests
- ModelContextProtocol.Tests
- Client
- Server
16 files changed
+1285
-3162
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| 123 | + | |
| 124 | + | |
123 | 125 | | |
124 | 126 | | |
125 | 127 | | |
| |||
154 | 156 | | |
155 | 157 | | |
156 | 158 | | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
161 | 167 | | |
162 | 168 | | |
163 | 169 | | |
| |||
170 | 176 | | |
171 | 177 | | |
172 | 178 | | |
173 | | - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
174 | 184 | | |
175 | 185 | | |
176 | 186 | | |
| |||
187 | 197 | | |
188 | 198 | | |
189 | 199 | | |
| 200 | + | |
| 201 | + | |
190 | 202 | | |
191 | 203 | | |
192 | 204 | | |
| |||
219 | 231 | | |
220 | 232 | | |
221 | 233 | | |
| 234 | + | |
222 | 235 | | |
223 | 236 | | |
224 | 237 | | |
| |||
718 | 731 | | |
719 | 732 | | |
720 | 733 | | |
| 734 | + | |
| 735 | + | |
721 | 736 | | |
722 | 737 | | |
723 | 738 | | |
| |||
795 | 810 | | |
796 | 811 | | |
797 | 812 | | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
798 | 839 | | |
799 | 840 | | |
800 | 841 | | |
| |||
812 | 853 | | |
813 | 854 | | |
814 | 855 | | |
815 | | - | |
816 | 856 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
593 | 593 | | |
594 | 594 | | |
595 | 595 | | |
596 | | - | |
597 | | - | |
598 | | - | |
599 | | - | |
| 596 | + | |
600 | 597 | | |
601 | 598 | | |
602 | 599 | | |
| |||
654 | 651 | | |
655 | 652 | | |
656 | 653 | | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
657 | 661 | | |
658 | 662 | | |
659 | 663 | | |
| |||
Lines changed: 39 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
2 | 7 | | |
3 | 8 | | |
4 | 9 | | |
5 | 10 | | |
6 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
7 | 45 | | |
Lines changed: 2 additions & 37 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
181 | | - | |
| 181 | + | |
182 | 182 | | |
183 | | - | |
| 183 | + | |
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | 291 | | |
327 | 292 | | |
328 | 293 | | |
| |||
0 commit comments