public void GetPostsTest()
        {
            UserRegisterRequestModel testUser = new UserRegisterRequestModel()
            {
                Username = "******",
                DisplayName = "validnick",
                AuthCode = new string('b', 40)
            };

            UserRegisterResponseModel userModel = RegisterTestUserWithSKey(httpServer, testUser);
            var headers = new Dictionary<string, string>();
            headers["X-sessionKey"] = userModel.SessionKey;

            PostResponseDetailedModel postModel = new PostResponseDetailedModel()
            {
                Title = "Test Post Title",
                Tags = new List<string>(),
                Text = "Basdlksdflksdfsdlfkj"
            };

            var response = CreatePost(httpServer, postModel, headers);

            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
            Assert.IsNotNull(response.Content);
        }
        public void MakeACommentForPostTest()
        {
            UserRegisterRequestModel testUser = new UserRegisterRequestModel()
            {
                Username = "******",
                DisplayName = "validnick",
                AuthCode = new string('b', 40)
            };

            UserRegisterResponseModel userModel = RegisterTestUserWithSKey(httpServer, testUser);
            var headers = new Dictionary<string, string>();
            headers["X-sessionKey"] = userModel.SessionKey;

            PostResponseDetailedModel postModel = new PostResponseDetailedModel()
            {
                Title = "Test Post Title",
                Tags = new List<string>() { "web" },
                Text = "Basdlksdflksdfsdlfkj"
            };

            CommentInPostModel commentModel = new CommentInPostModel()
            {
                Text = "Mocking is nice!"
            };

            var returnedModel = CreatePostAndReturnModel(httpServer, postModel, headers);
            var getResponse = MakeCommentForPost(httpServer, returnedModel.Id, commentModel, headers);

            Assert.AreEqual(HttpStatusCode.Created, getResponse.StatusCode);
        }
        private HttpResponseMessage GetPostsByTags(InMemoryHttpServer httpServer, PostResponseDetailedModel postModel, Dictionary<string, string> headers)
        {
            var response = httpServer.Post("api/posts?tags=web", postModel, headers);
            var contentString = response.Content.ReadAsStringAsync().Result;
            //var userModel = JsonConvert.DeserializeObject<PostResponseDetailedModel>(contentString);

            return response;
        }
        private PostResponseDetailedModel CreatePostAndReturnModel(InMemoryHttpServer httpServer, PostResponseDetailedModel postModel, Dictionary<string, string> headers)
        {
            var response = httpServer.Post("api/posts", postModel, headers);
            var contentString = response.Content.ReadAsStringAsync().Result;
            var returnedPostModel = JsonConvert.DeserializeObject<PostResponseDetailedModel>(contentString);

            return returnedPostModel;
        }