114
|
1 using System;
|
|
2 using System.Collections.Generic;
|
|
3 using System.Net;
|
112
|
4 using NUnit.Framework;
|
|
5 using SSRS.Services.DTO;
|
|
6 using ServiceStack.Service;
|
|
7 using ServiceStack.ServiceClient.Web;
|
|
8
|
|
9 namespace SSRS.Services.WebTests
|
|
10 {
|
|
11 [TestFixture]
|
|
12 public class ReportsServiceFixture
|
|
13 {
|
|
14 [Test]
|
114
|
15 public void ReportsService_REST_PUT_returns_reportList_greater_than_zero()
|
112
|
16 {
|
114
|
17 //var webRequest = (HttpWebRequest)WebRequestCreator.ClientHttp.Create(new Uri(_baseUri + uri));
|
|
18 //webRequest.Method = method;
|
|
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));
|
112
|
59 }
|
|
60 }
|
|
61 }
|