@@ -39,8 +39,12 @@ public void MultipartFormData_WithParameterAndFile_Async()
39
39
using ( SimpleServer . Create ( baseUrl , EchoHandler ) )
40
40
{
41
41
RestClient client = new RestClient ( baseUrl ) ;
42
- RestRequest request = new RestRequest ( "/" , Method . POST ) { AlwaysMultipartFormData = true } ;
43
- DirectoryInfo directoryInfo = Directory . GetParent ( Directory . GetCurrentDirectory ( ) ) . Parent ;
42
+ RestRequest request = new RestRequest ( "/" , Method . POST )
43
+ {
44
+ AlwaysMultipartFormData = true
45
+ } ;
46
+ DirectoryInfo directoryInfo = Directory . GetParent ( Directory . GetCurrentDirectory ( ) )
47
+ . Parent ;
44
48
45
49
if ( directoryInfo != null )
46
50
{
@@ -53,10 +57,10 @@ public void MultipartFormData_WithParameterAndFile_Async()
53
57
request . AddParameter ( "controlName" , "test" , "application/json" , ParameterType . RequestBody ) ;
54
58
55
59
Task task = client . ExecuteTaskAsync ( request )
56
- . ContinueWith ( x =>
57
- {
58
- Assert . AreEqual ( this . expectedFileAndBodyRequestContent , x . Result . Content ) ;
59
- } ) ;
60
+ . ContinueWith ( x =>
61
+ {
62
+ Assert . AreEqual ( this . expectedFileAndBodyRequestContent , x . Result . Content ) ;
63
+ } ) ;
60
64
61
65
task . Wait ( ) ;
62
66
}
@@ -70,13 +74,16 @@ public void MultipartFormData_WithParameterAndFile()
70
74
using ( SimpleServer . Create ( baseUrl , EchoHandler ) )
71
75
{
72
76
RestClient client = new RestClient ( baseUrl ) ;
73
- RestRequest request = new RestRequest ( "/" , Method . POST ) { AlwaysMultipartFormData = true } ;
74
- DirectoryInfo directoryInfo = Directory . GetParent ( Directory . GetCurrentDirectory ( ) ) . Parent ;
77
+ RestRequest request = new RestRequest ( "/" , Method . POST )
78
+ {
79
+ AlwaysMultipartFormData = true
80
+ } ;
81
+ DirectoryInfo directoryInfo = Directory . GetParent ( Directory . GetCurrentDirectory ( ) )
82
+ . Parent ;
75
83
76
84
if ( directoryInfo != null )
77
85
{
78
- string path = Path . Combine ( directoryInfo . FullName ,
79
- "Assets\\ TestFile.txt" ) ;
86
+ string path = Path . Combine ( directoryInfo . FullName , "Assets\\ TestFile.txt" ) ;
80
87
81
88
request . AddFile ( "fileName" , path ) ;
82
89
}
@@ -96,7 +103,10 @@ public void MultipartFormDataAsync()
96
103
using ( SimpleServer . Create ( baseUrl , EchoHandler ) )
97
104
{
98
105
RestClient client = new RestClient ( baseUrl ) ;
99
- RestRequest request = new RestRequest ( "/" , Method . POST ) { AlwaysMultipartFormData = true } ;
106
+ RestRequest request = new RestRequest ( "/" , Method . POST )
107
+ {
108
+ AlwaysMultipartFormData = true
109
+ } ;
100
110
101
111
AddParameters ( request ) ;
102
112
@@ -116,7 +126,10 @@ public void MultipartFormData()
116
126
using ( SimpleServer . Create ( baseUrl , EchoHandler ) )
117
127
{
118
128
RestClient client = new RestClient ( baseUrl ) ;
119
- RestRequest request = new RestRequest ( "/" , Method . POST ) { AlwaysMultipartFormData = true } ;
129
+ RestRequest request = new RestRequest ( "/" , Method . POST )
130
+ {
131
+ AlwaysMultipartFormData = true
132
+ } ;
120
133
121
134
AddParameters ( request ) ;
122
135
@@ -135,10 +148,10 @@ public void AlwaysMultipartFormData_WithParameter_Execute()
135
148
{
136
149
RestClient client = new RestClient ( baseUrl ) ;
137
150
RestRequest request = new RestRequest ( "?json_route=/posts" )
138
- {
139
- AlwaysMultipartFormData = true ,
140
- Method = Method . POST ,
141
- } ;
151
+ {
152
+ AlwaysMultipartFormData = true ,
153
+ Method = Method . POST ,
154
+ } ;
142
155
143
156
request . AddParameter ( "title" , "test" , ParameterType . RequestBody ) ;
144
157
@@ -164,7 +177,8 @@ public void AlwaysMultipartFormData_WithParameter_ExecuteTaskAsync()
164
177
165
178
request . AddParameter ( "title" , "test" , ParameterType . RequestBody ) ;
166
179
167
- Task task = client . ExecuteTaskAsync ( request ) . ContinueWith ( x => { Assert . Null ( x . Result . ErrorException ) ; } ) ;
180
+ Task task = client . ExecuteTaskAsync ( request )
181
+ . ContinueWith ( x => { Assert . Null ( x . Result . ErrorException ) ; } ) ;
168
182
169
183
task . Wait ( ) ;
170
184
}
@@ -218,4 +232,4 @@ private static void AddParameters(IRestRequest request)
218
232
request . AddParameter ( "a name with spaces" , "somedata" ) ;
219
233
}
220
234
}
221
- }
235
+ }
0 commit comments