Skip to content

Commit 2871652

Browse files
committed
fix README + src/test tweaks
1 parent 5133339 commit 2871652

4 files changed

Lines changed: 43 additions & 28 deletions

File tree

src/RestFiles/RestFiles.Tests/AsyncRestClientTests.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public void Can_GetAsync_to_retrieve_existing_file()
7777
var restClient = CreateAsyncRestClient();
7878

7979
FilesResponse response = null;
80-
restClient.GetAsync<FilesResponse>(WebServiceHostUrl + "files/README.txt",
80+
restClient.GetAsync<FilesResponse>("files/README.txt",
8181
r => response = r, FailOnAsyncError);
8282

8383
Thread.Sleep(1000);
@@ -91,7 +91,7 @@ public void Can_GetAsync_to_retrieve_existing_folder_listing()
9191
var restClient = CreateAsyncRestClient();
9292

9393
FilesResponse response = null;
94-
restClient.GetAsync<FilesResponse>(WebServiceHostUrl + "files/",
94+
restClient.GetAsync<FilesResponse>("files/",
9595
r => response = r, FailOnAsyncError);
9696

9797
Thread.Sleep(1000);
@@ -106,7 +106,7 @@ public void Can_PostAsync_to_path_without_uploaded_files_to_create_a_new_Directo
106106
var restClient = CreateAsyncRestClient();
107107

108108
FilesResponse response = null;
109-
restClient.PostAsync<FilesResponse>(WebServiceHostUrl + "files/SubFolder/NewFolder",
109+
restClient.PostAsync<FilesResponse>("files/SubFolder/NewFolder",
110110
new Files(),
111111
r => response = r, FailOnAsyncError);
112112

@@ -134,7 +134,7 @@ public void Can_RestClient_POST_upload_file_to_save_new_file_and_create_new_Dire
134134
var restClient = (IRestClient) CreateAsyncRestClient();
135135

136136
var fileToUpload = new FileInfo(FilesRootDir + "TESTUPLOAD.txt");
137-
restClient.PostFile<FilesResponse>(WebServiceHostUrl + "files/UploadedFiles/",
137+
restClient.PostFile<FilesResponse>("files/UploadedFiles/",
138138
fileToUpload, MimeTypes.GetMimeType(fileToUpload.Name));
139139

140140
Assert.That(Directory.Exists(FilesRootDir + "UploadedFiles"));
@@ -148,7 +148,7 @@ public void Can_PutAsync_to_replace_text_content_of_an_existing_file()
148148
var restClient = CreateAsyncRestClient();
149149

150150
FilesResponse response = null;
151-
restClient.PutAsync<FilesResponse>(WebServiceHostUrl + "files/README.txt",
151+
restClient.PutAsync<FilesResponse>("files/README.txt",
152152
new Files { TextContents = ReplacedFileContents },
153153
r => response = r, FailOnAsyncError);
154154

@@ -164,7 +164,7 @@ public void Can_DeleteAsync_to_replace_text_content_of_an_existing_file()
164164
var restClient = CreateAsyncRestClient();
165165

166166
FilesResponse response = null;
167-
restClient.DeleteAsync<FilesResponse>(WebServiceHostUrl + "files/README.txt",
167+
restClient.DeleteAsync<FilesResponse>("files/README.txt",
168168
r => response = r, FailOnAsyncError);
169169

170170
Thread.Sleep(1000);
@@ -184,7 +184,7 @@ public void GET_a_file_that_doesnt_exist_throws_a_404_FileNotFoundException()
184184
WebServiceException webEx = null;
185185
FilesResponse response = null;
186186

187-
restClient.GetAsync<FilesResponse>(WebServiceHostUrl + "files/UnknownFolder",
187+
restClient.GetAsync<FilesResponse>("files/UnknownFolder",
188188
r => response = r,
189189
(r, ex) =>
190190
{
@@ -208,7 +208,7 @@ public void POST_to_an_existing_file_throws_a_500_NotSupportedException()
208208

209209
try
210210
{
211-
var response = restClient.PostFile<FilesResponse>(WebServiceHostUrl + "files/README.txt",
211+
var response = restClient.PostFile<FilesResponse>("files/README.txt",
212212
fileToUpload, MimeTypes.GetMimeType(fileToUpload.Name));
213213

214214
Assert.Fail("Should fail with NotSupportedException");
@@ -231,7 +231,7 @@ public void PUT_to_replace_a_non_existing_file_throws_404()
231231
WebServiceException webEx = null;
232232
FilesResponse response = null;
233233

234-
restClient.PutAsync<FilesResponse>(WebServiceHostUrl + "files/non-existing-file.txt",
234+
restClient.PutAsync<FilesResponse>("files/non-existing-file.txt",
235235
new Files { TextContents = ReplacedFileContents },
236236
r => response = r,
237237
(r, ex) =>
@@ -255,7 +255,7 @@ public void DELETE_a_non_existing_file_throws_404()
255255
WebServiceException webEx = null;
256256
FilesResponse response = null;
257257

258-
restClient.DeleteAsync<FilesResponse>(WebServiceHostUrl + "files/non-existing-file.txt",
258+
restClient.DeleteAsync<FilesResponse>("files/non-existing-file.txt",
259259
r => response = r,
260260
(r, ex) =>
261261
{

src/RestFiles/RestFiles/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ The /files service exposes a complete strong-typed REST-ful API, the entire impl
1919
As it was developed using the http://servicestack.net Open Source .NET/Mono Web Services Framework
2020
it also able to expose this REST-ful API over a myraid of formats (with no extra code/config):
2121

22-
json - http://localhost/RestFiles/files/dtos/Types?format=json
23-
xml - http://localhost/RestFiles/files/dtos/Types?format=xml
24-
jsv - http://localhost/RestFiles/files/dtos/Types?format=jsv&debug=true
25-
csv - http://localhost/RestFiles/files/dtos/Types?format=csv
22+
* [json](http://localhost/RestFiles/files/dtos/Types?format=json)
23+
* [xml](http://localhost/RestFiles/files/dtos/Types?format=xml)
24+
* [jsv](http://localhost/RestFiles/files/dtos/Types?format=jsv&debug=true)
25+
* [csv](http://localhost/RestFiles/files/dtos/Types?format=csv)
2626

2727
*Note: The speed of web services are faster than what they appear, as the delay + animations are for
2828
gratuitous purposes only :) All but the xml format uses the high-performance cross-platform,
@@ -32,15 +32,15 @@ it also able to expose this REST-ful API over a myraid of formats (with no extra
3232

3333
SOAP 1.1/1.2 endpoints are also available at the following url:
3434

35-
soap11 - http://localhost/RestFiles/servicestack/soap11
36-
soap12 - http://localhost/RestFiles/servicestack/soap12
35+
* [soap11](http://localhost/RestFiles/servicestack/soap11)
36+
* [soap12](http://localhost/RestFiles/servicestack/soap12)
3737

3838
As a result of the strong-typed DTO pattern used to define the the webservice, ServiceStack is able to
3939
generate the xsds, wsdls, metadata documentation on the fly at:
4040

41-
docs - http://localhost/RestFiles/servicestack/metadata
42-
xsd - http://localhost/RestFiles/servicestack/metadata?xsd=1
43-
wsdl - http://localhost/RestFiles/servicestack/soap12 (HTTP GET)
41+
* [docs](http://localhost/RestFiles/servicestack/metadata)
42+
* [xsd](http://localhost/RestFiles/servicestack/metadata?xsd=1)
43+
* [wsdl](http://localhost/RestFiles/servicestack/soap12) (HTTP GET)
4444

4545

4646
## Live Demo

src/RestFiles/RestFiles/RestFiles.csproj

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
55
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6-
<ProductVersion>9.0.21022</ProductVersion>
6+
<ProductVersion>9.0.30729</ProductVersion>
77
<SchemaVersion>2.0</SchemaVersion>
88
<ProjectGuid>{3A8D2349-6E97-47A2-AC49-EFE7D89C0344}</ProjectGuid>
99
<ProjectTypeGuids>{349C5851-65DF-11DA-9384-00065B846F21};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
@@ -79,19 +79,31 @@
7979
<Content Include="css\default.css" />
8080
<Content Include="default.htm" />
8181
<Content Include="img\bg-body-1024.png" />
82+
<Content Include="img\bg-footer.png" />
8283
<Content Include="img\bg_gradient.gif" />
8384
<Content Include="img\btn-github.png" />
85+
<Content Include="img\Chrome_logo.png" />
86+
<Content Include="img\delete_icon.png" />
8487
<Content Include="img\dir.png" />
8588
<Content Include="img\file_head.gif" />
89+
<Content Include="img\ie8_logo.jpg" />
8690
<Content Include="img\logo-24x24.png" />
8791
<Content Include="img\logo-32x32.png" />
8892
<Content Include="img\logo-txt-small.png" />
93+
<Content Include="img\Mono-powered-big.png" />
94+
<Content Include="img\Mozilla_logo.png" />
95+
<Content Include="img\Opera_logo.png" />
8996
<Content Include="img\public.png" />
97+
<Content Include="img\rip-ie6.jpg" />
9098
<Content Include="img\row_bg.png" />
99+
<Content Include="img\Safari_logo.jpg" />
91100
<Content Include="img\txt.png" />
92101
<Content Include="js\ajaxfileupload.js" />
93102
<Content Include="Web.config" />
94103
</ItemGroup>
104+
<ItemGroup>
105+
<None Include="README.md" />
106+
</ItemGroup>
95107
<ItemGroup>
96108
<Folder Include="App_Data\" />
97109
</ItemGroup>
@@ -114,6 +126,9 @@
114126
<DevelopmentServerVPath>/</DevelopmentServerVPath>
115127
<IISUrl>http://localhost/RestFiles</IISUrl>
116128
<NTLMAuthentication>False</NTLMAuthentication>
129+
<UseCustomServer>False</UseCustomServer>
130+
<CustomServerUrl>
131+
</CustomServerUrl>
117132
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
118133
</WebProjectProperties>
119134
</FlavorProperties>

src/ServiceStack.Examples/ServiceStack.Examples.Clients/default.htm

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,14 @@ <h5>Client code</h5>
192192
<div class="dtos">
193193
<h5>Request and Response DataContracts (DTOs)</h5>
194194
<code class="dto">
195-
[DataContract(Namespace = "http://schemas.sericestack.net/examples/types")]
195+
[DataContract]
196196
public class GetFactorial
197197
{
198198
[DataMember]
199199
public long ForNumber { get; set; }
200200
}
201201

202-
[DataContract(Namespace = "http://schemas.sericestack.net/examples/types")]
202+
[DataContract]
203203
public class GetFactorialResponse
204204
{
205205
[DataMember]
@@ -263,7 +263,7 @@ <h5>Client code</h5>
263263
<div class="dtos">
264264
<h5>Request and Response DataContracts (DTOs)</h5>
265265
<code class="dto">
266-
[DataContract(Namespace = "http://schemas.sericestack.net/examples/types")]
266+
[DataContract]
267267
public class GetFibonacciNumbers
268268
{
269269
[DataMember]
@@ -273,7 +273,7 @@ <h5>Request and Response DataContracts (DTOs)</h5>
273273
public long? Take { get; set; }
274274
}
275275

276-
[DataContract(Namespace = "http://schemas.sericestack.net/examples/types")]
276+
[DataContract]
277277
public class GetFibonacciNumbersResponse
278278
{
279279
[DataMember]
@@ -377,7 +377,7 @@ <h5>Client code</h5>
377377
<div class="dtos">
378378
<h5>Request and Response DataContracts (DTOs)</h5>
379379
<code class="dto">
380-
[DataContract(Namespace = "http://schemas.sericestack.net/examples/types")]
380+
[DataContract]
381381
public class StoreNewUser
382382
{
383383
[DataMember]
@@ -390,7 +390,7 @@ <h5>Request and Response DataContracts (DTOs)</h5>
390390
public string Password { get; set; }
391391
}
392392

393-
[DataContract(Namespace = "http://schemas.sericestack.net/examples/types")]
393+
[DataContract]
394394
public class StoreNewUserResponse
395395
{
396396
public StoreNewUserResponse()
@@ -494,7 +494,7 @@ <h5>Client code</h5>
494494
<div class="dtos">
495495
<h5>Request and Response DataContracts (DTOs)</h5>
496496
<code class="dto">
497-
[DataContract(Namespace = "http://schemas.sericestack.net/examples/types")]
497+
[DataContract]
498498
public class GetUsers
499499
{
500500
[DataMember]
@@ -504,7 +504,7 @@ <h5>Request and Response DataContracts (DTOs)</h5>
504504
public ArrayOfString UserNames { get; set; }
505505
}
506506

507-
[DataContract(Namespace = "http://schemas.sericestack.net/examples/types")]
507+
[DataContract]
508508
public class GetUsersResponse
509509
{
510510
public GetUsersResponse()

0 commit comments

Comments
 (0)