OpenRasta Unit Testing GET results in 404 error <p>I've completed my implementation of my first OpenRasta RESTful webservice and have successfully got the GET requests I wish for working.</p> <p>Therefore I've taken some 'inspiration' from Daniel Irvine with his post <a href="http://danielirvine.com/blog/2011/06/08/testing-restful-services-with-openrasta/" rel="nofollow">http://danielirvine.com/blog/2011/06/08/testing-restful-services-with-openrasta/</a> to built a automated test project to test the implmentation.</p> <p>I've created my own test class but I'm constantly getting a 404 error as the reponse status code.</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using OpenRasta.Hosting.InMemory; using PoppyService; using OpenRasta.Web; using System.IO; using System.Runtime.Serialization.Json; using Microsoft.VisualStudio.TestTools.UnitTesting; using NUnit.Framework; namespace PoppyServiceTests { //http://danielirvine.com/blog/2011/06/08/testing-restful-services-with-openrasta/ [TestFixture] class OpenRastaJSONTestMehods { [TestCase("http://localhost/PoppyService/users")] public static void GET(string uri) { const string PoppyLocalHost = "http://localhost/PoppyService/"; if (uri.Contains(PoppyLocalHost)) GET(new Uri(uri)); else throw new UriFormatException(string.Format("The uri doesn't contain {0}", PoppyLocalHost)); } [Test] public static void GET(Uri serviceuri) { using (var host = new InMemoryHost(new Configuration())) { var request = new InMemoryRequest() { Uri = serviceuri, HttpMethod = "GET" }; // set up your code formats - I'm using // JSON because it's awesome request.Entity.ContentType = MediaType.Json; request.Entity.Headers["Accept"] = "application/json"; // send the request and save the resulting response var response = host.ProcessRequest(request); int statusCode = response.StatusCode; NUnit.Framework.Assert.AreEqual(200, statusCode, string.Format("Http StatusCode Error: {0}", statusCode)); // deserialize the content from the response object returnedObject; if (response.Entity.ContentLength &gt; 0) { // you must rewind the stream, as OpenRasta // won't do this for you response.Entity.Stream.Seek(0, SeekOrigin.Begin); var serializer = new DataContractJsonSerializer(typeof(object)); returnedObject = serializer.ReadObject(response.Entity.Stream); } } } } </code></pre> <p>}</p> <p>If I navigate to the Uri manually in the browser I'm getting the correct responce and HTTP 200.</p> <p>It's possibly something to do with my Configuration class, but if I test all the Uris manaully again I get the correct result.</p> <pre><code>public class Configuration : IConfigurationSource { public void Configure() { using (OpenRastaConfiguration.Manual) { ResourceSpace.Has.ResourcesOfType&lt;TestPageResource&gt;() .AtUri("/testpage").HandledBy&lt;TestPageHandler&gt;().RenderedByAspx("~/Views/DummyView.aspx"); ResourceSpace.Has.ResourcesOfType&lt;IList&lt;AppUser&gt;&gt;() .AtUri("/users").And .AtUri("/user/{appuserid}").HandledBy&lt;UserHandler&gt;().AsJsonDataContract(); ResourceSpace.Has.ResourcesOfType&lt;AuthenticationResult&gt;() .AtUri("/user").HandledBy&lt;UserHandler&gt;().AsJsonDataContract(); ResourceSpace.Has.ResourcesOfType&lt;IList&lt;Client&gt;&gt;() .AtUri("/clients").And .AtUri("/client/{clientid}").HandledBy&lt;ClientsHandler&gt;().AsJsonDataContract(); ResourceSpace.Has.ResourcesOfType&lt;IList&lt;Agency&gt;&gt;() .AtUri("/agencies").And .AtUri("/agency/{agencyid}").HandledBy&lt;AgencyHandler&gt;().AsJsonDataContract(); ResourceSpace.Has.ResourcesOfType&lt;IList&lt;ClientApps&gt;&gt;() .AtUri("/clientapps/{appid}").HandledBy&lt;ClientAppsHandler&gt;().AsJsonDataContract(); ResourceSpace.Has.ResourcesOfType&lt;Client&gt;() .AtUri("/agencyclients").And .AtUri("/agencyclients/{agencyid}").HandledBy&lt;AgencyClientsHandler&gt;().AsJsonDataContract(); ResourceSpace.Has.ResourcesOfType&lt;Client&gt;() .AtUri("/agencyplususerclients/{appuserid}").HandledBy&lt;AgencyPlusUserClientsHandler&gt;().AsJsonDataContract(); ResourceSpace.Has.ResourcesOfType&lt;IList&lt;Permission&gt;&gt;() .AtUri("/permissions/{appuserid}/{appid}").HandledBy&lt;PermissionsHandler&gt;().AsJsonDataContract(); ResourceSpace.Has.ResourcesOfType&lt;IList&lt;Role&gt;&gt;() .AtUri("/roles").And .AtUri("/roles/{appuserid}").And.AtUri("/roles/{appuserid}/{appid}").HandledBy&lt;RolesHandler&gt;().AsJsonDataContract(); ResourceSpace.Has.ResourcesOfType&lt;IList&lt;AppVersion&gt;&gt;() .AtUri("/userappversion").And .AtUri("/userappversion/{appuserid}").HandledBy&lt;UserAppVersionHandler&gt;().AsJsonDataContract(); } } } </code></pre> <p>Any suggestions would be greatfully received.</p>