comparison SSRS/SSRS.Services.WebTests/ReportsServiceFixture.cs @ 114:e51a6af1c98d

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