@@ -147,6 +147,19 @@ public void GET_with_Uri_containing_tokens()
147
147
Assert . Equal ( expected , output ) ;
148
148
}
149
149
150
+ [ Fact ]
151
+ public void GET_with_Url_string_containing_tokens ( )
152
+ {
153
+ var request = new RestRequest ( ) ;
154
+ request . AddUrlSegment ( "foo" , "bar" ) ;
155
+ var client = new RestClient ( "http://example.com/{foo}" ) ;
156
+
157
+ var expected = new Uri ( "http://example.com/bar" ) ;
158
+ var output = client . BuildUri ( request ) ;
159
+
160
+ Assert . Equal ( expected , output ) ;
161
+ }
162
+
150
163
[ Fact ]
151
164
public void GET_with_Uri_and_resource_containing_tokens ( )
152
165
{
@@ -160,5 +173,28 @@ public void GET_with_Uri_and_resource_containing_tokens()
160
173
161
174
Assert . Equal ( expected , output ) ;
162
175
}
176
+
177
+ [ Fact ]
178
+ public void GET_with_Url_string_and_resource_containing_tokens ( )
179
+ {
180
+ var request = new RestRequest ( "resource/{baz}" ) ;
181
+ request . AddUrlSegment ( "foo" , "bar" ) ;
182
+ request . AddUrlSegment ( "baz" , "bat" ) ;
183
+ var client = new RestClient ( "http://example.com/{foo}" ) ;
184
+
185
+ var expected = new Uri ( "http://example.com/bar/resource/bat" ) ;
186
+ var output = client . BuildUri ( request ) ;
187
+
188
+ Assert . Equal ( expected , output ) ;
189
+ }
190
+
191
+ [ Fact ]
192
+ public void GET_with_Invalid_Url_string_throws_exception ( )
193
+ {
194
+ Assert . Throws < UriFormatException > ( delegate
195
+ {
196
+ var client = new RestClient ( "invalid url" ) ;
197
+ } ) ;
198
+ }
163
199
}
164
200
}
0 commit comments