private HttpResponseMessage LogoutUser(
            InMemoryHttpServer httpServer, string sessionKey)
        {
            var headers = new Dictionary<string, string>();
            headers["X-sessionKey"] = sessionKey;

            var response = httpServer.Put("api/users/logout", null, headers);
            return response;
        }
 private LoggedUserModel RegisterTestUser(InMemoryHttpServer httpServer, UserModel testUser)
 {
     var response = httpServer.Post("api/users/register", testUser);
     var contentString = response.Content.ReadAsStringAsync().Result;
     var userModel = JsonConvert.DeserializeObject<LoggedUserModel>(contentString);
     return userModel;
 }
        public void TestInit()
        {
            var type = typeof(PostsController);
            tran = new TransactionScope();

            var routes = new List<Route>
            {
                new Route(
                    "PostsByTagApi",
                    "api/tags/{tagId}/posts",
                    new
                    {
                        controller = "posts"
                    }),
                new Route(
                    "PostsCommentApi",
                    "api/posts/{postId}/comment",
                    new
                    {
                        controller = "posts"
                    }),
                new Route(
                    "UsersApi",
                    "api/users/{action}/",
                    new
                    {
                        controller = "users"
                    }),
                new Route(
                    "DefaultApi",
                    "api/{controller}/{id}",
                    new { id = RouteParameter.Optional }),
            };

            this.httpServer = new InMemoryHttpServer("http://localhost/", routes);
        }