annotate SSRS/SSRS.Services.WebTests/ReportsServiceFixture.cs @ 116:d3380f499575

requires layout tidy up
author stevenh7776
date Sun, 20 May 2012 18:48:00 +0100
parents e51a6af1c98d
children
rev   line source
114
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
1 using System;
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
2 using System.Collections.Generic;
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
3 using System.Net;
112
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
4 using NUnit.Framework;
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
5 using SSRS.Services.DTO;
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
6 using ServiceStack.Service;
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
7 using ServiceStack.ServiceClient.Web;
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
8
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
9 namespace SSRS.Services.WebTests
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
10 {
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
11 [TestFixture]
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
12 public class ReportsServiceFixture
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
13 {
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
14 [Test]
114
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
15 public void ReportsService_REST_PUT_returns_reportList_greater_than_zero()
112
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
16 {
114
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
17 //var webRequest = (HttpWebRequest)WebRequestCreator.ClientHttp.Create(new Uri(_baseUri + uri));
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
18 //webRequest.Method = method;
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
19
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
20 //// if cookies are enabled, pass them in from the browser
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
21 //if (this.EnableCookies)
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
22 //{
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
23 // webRequest.CookieContainer = new CookieContainer();
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
24 // webRequest.CookieContainer.SetCookies(new Uri(_baseUri), HtmlPage.Document.Cookies);
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
25 //}
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
26
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
27 //// set the accept header so our response is in json
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
28 //webRequest.Accept = "application/json";
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
29 //var client = new ServiceClient<ReportsRequest, ReportsResponse>();
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
30 //client.Completed += (sender, args) =>
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
31 // {
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
32 // // check for web exceptions
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
33 // var webEx = args.Error as WebException;
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
34 // if (webEx != null)
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
35 // {
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
36 // var webResponse = (HttpWebResponse) webEx.Response;
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
37
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
38 // ErrorText = string.Format("WebException: {0} {1} {2}",
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
39 // webResponse.ResponseUri,
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
40 // webResponse.Method, webResponse.StatusDescription);
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
41
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
42 // return;
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
43 // }
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
44
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
45 // // re-throw any other exceptions
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
46 // if (args.Error != null)
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
47 // throw args.Error;
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
48
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
49 // var result = args.Response.Result;
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
50 // if (result == null) return;
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
51 // };
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
52
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
53 //client.Post("/reports", new ReportsRequest() {IncludeParameters = true});
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
54
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
55 //var restClient = new JsonServiceClient("http://localhost:2505/services") as IRestClient;
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
56 //var request = new ReportsRequest() { IncludeParameters = true };
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
57 //var response = restClient.Put<ReportsResponse>("/reports", request);
e51a6af1c98d working version
adminsh@apollo
parents: 112
diff changeset
58 //Assert.That(response.Result, Is.GreaterThan(0));
112
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
59 }
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
60 }
b9d5f934cb21 Initial upload
adminsh@apollo
parents:
diff changeset
61 }