File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
RestSharp.IntegrationTests Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ namespace RestSharp.IntegrationTests
8
8
{
9
9
public class CustomRequestSerializerTests
10
10
{
11
- private SimpleServer _server ;
12
11
private const string BASE_URL = "http://localhost:8888/" ;
13
12
14
13
[ Test ]
@@ -29,7 +28,7 @@ public void Should_use_custom_xml_serializer()
29
28
}
30
29
31
30
[ Test ]
32
- public void Should_use_custom_json_serializer ( )
31
+ public void Should_use_custom_json_serializer_for_addbody ( )
33
32
{
34
33
using ( SimpleServer . Create ( BASE_URL ) )
35
34
{
@@ -45,6 +44,23 @@ public void Should_use_custom_json_serializer()
45
44
}
46
45
}
47
46
47
+ [ Test ]
48
+ public void Should_use_custom_json_serializer ( )
49
+ {
50
+ using ( SimpleServer . Create ( BASE_URL ) )
51
+ {
52
+ var client = new RestClient ( BASE_URL ) ;
53
+ var serializer = new CustomJsonSerializer ( ) ;
54
+ var body = new { Text = "text" } ;
55
+
56
+ var request = new RestRequest ( "/" ) { JsonSerializer = serializer } ;
57
+ request . AddJsonBody ( body ) ;
58
+ client . Execute ( request ) ;
59
+
60
+ serializer . BodyString . ShouldBe ( body . ToString ( ) ) ;
61
+ }
62
+ }
63
+
48
64
private class CustomXmlSerializer : IXmlSerializer
49
65
{
50
66
public string BodyString { get ; private set ; }
You can’t perform that action at this time.
0 commit comments