1
- using System ;
1
+ using System ;
2
2
using System . Collections . Generic ;
3
3
using System . Linq ;
4
4
using FluentAssertions ;
@@ -56,6 +56,24 @@ public override IEnumerable<ValueTuple<string, Renor[]>> GetValues()
56
56
new Request ( 4 , "subtract" , JObject . FromObject ( new { minuend = 42 , subtrahend = 23 } ) )
57
57
} ) ;
58
58
59
+ yield return (
60
+ @"{""jsonrpc"": ""2.0"", ""method"": ""subtract"", ""id"": 4}" ,
61
+ new Renor [ ]
62
+ {
63
+ new Request ( 4 , "subtract" , null )
64
+ } ) ;
65
+
66
+ // http://www.jsonrpc.org/specification says:
67
+ // If present, parameters for the rpc call MUST be provided as a Structured value.
68
+ // Some clients may serialize params as null, instead of omitting it
69
+ // We're going to pretend we never got the null in the first place.
70
+ yield return (
71
+ @"{""jsonrpc"": ""2.0"", ""method"": ""subtract"", ""params"": null, ""id"": 4}" ,
72
+ new Renor [ ]
73
+ {
74
+ new Request ( 4 , "subtract" , null )
75
+ } ) ;
76
+
59
77
yield return (
60
78
@"{""jsonrpc"": ""2.0"", ""method"": ""update"", ""params"": [1,2,3,4,5]}" ,
61
79
new Renor [ ]
@@ -70,6 +88,17 @@ public override IEnumerable<ValueTuple<string, Renor[]>> GetValues()
70
88
new Notification ( "foobar" , null )
71
89
} ) ;
72
90
91
+ // http://www.jsonrpc.org/specification says:
92
+ // If present, parameters for the rpc call MUST be provided as a Structured value.
93
+ // Some clients may serialize params as null, instead of omitting it
94
+ // We're going to pretend we never got the null in the first place.
95
+ yield return (
96
+ @"{""jsonrpc"": ""2.0"", ""method"": ""foobar"", ""params"": null}" ,
97
+ new Renor [ ]
98
+ {
99
+ new Notification ( "foobar" , null )
100
+ } ) ;
101
+
73
102
yield return (
74
103
@"{""jsonrpc"": ""2.0"", ""method"": 1, ""params"": ""bar""}" ,
75
104
new Renor [ ]
@@ -144,4 +173,4 @@ public override IEnumerable<ValueTuple<string, bool>> GetValues()
144
173
}
145
174
}
146
175
}
147
- }
176
+ }
0 commit comments