Mercurial > silverbladetech
diff 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 |
line wrap: on
line diff
--- a/SSRS/SSRS.Services.WebTests/ReportsServiceFixture.cs Sat May 19 16:21:07 2012 +0100 +++ b/SSRS/SSRS.Services.WebTests/ReportsServiceFixture.cs Sat May 19 16:53:34 2012 +0100 @@ -1,4 +1,6 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; +using System.Net; using NUnit.Framework; using SSRS.Services.DTO; using ServiceStack.Service; @@ -10,11 +12,50 @@ public class ReportsServiceFixture { [Test] - public void ReportsService_REST_GET_returns_reportList_greater_than_zero() + public void ReportsService_REST_PUT_returns_reportList_greater_than_zero() { - var restClient = new JsonServiceClient("http://localhost:2505/services") as IRestClient; - var allReports = restClient.Get<List<ReportInfo>>("/reports"); - Assert.That(allReports.Count, Is.GreaterThan(0)); + //var webRequest = (HttpWebRequest)WebRequestCreator.ClientHttp.Create(new Uri(_baseUri + uri)); + //webRequest.Method = method; + + //// if cookies are enabled, pass them in from the browser + //if (this.EnableCookies) + //{ + // webRequest.CookieContainer = new CookieContainer(); + // webRequest.CookieContainer.SetCookies(new Uri(_baseUri), HtmlPage.Document.Cookies); + //} + + //// set the accept header so our response is in json + //webRequest.Accept = "application/json"; + //var client = new ServiceClient<ReportsRequest, ReportsResponse>(); + //client.Completed += (sender, args) => + // { + // // check for web exceptions + // var webEx = args.Error as WebException; + // if (webEx != null) + // { + // var webResponse = (HttpWebResponse) webEx.Response; + + // ErrorText = string.Format("WebException: {0} {1} {2}", + // webResponse.ResponseUri, + // webResponse.Method, webResponse.StatusDescription); + + // return; + // } + + // // re-throw any other exceptions + // if (args.Error != null) + // throw args.Error; + + // var result = args.Response.Result; + // if (result == null) return; + // }; + + //client.Post("/reports", new ReportsRequest() {IncludeParameters = true}); + + //var restClient = new JsonServiceClient("http://localhost:2505/services") as IRestClient; + //var request = new ReportsRequest() { IncludeParameters = true }; + //var response = restClient.Put<ReportsResponse>("/reports", request); + //Assert.That(response.Result, Is.GreaterThan(0)); } } }