public void Post_ShouldReturnData()
        {
            var testUser = new UserDto()
            {
                Username = "******",
                DisplayName = "VALIDDISPLAYNAME",
                AuthCode = new string('b', 40)
            };

            var post = new PostDto()
            {
                Title = "Test Title",
                Content = "Test post text",
                Tags = new List<string>() { "tag1", "Tag2" }
            };


            UserLogedDto userModel = RegisterTestUser(httpServer, testUser);
            var response = httpServer.Post("api/posts?sessionKey=" + userModel.SessionKey, post);

            Assert.AreEqual(HttpStatusCode.Created, response.StatusCode);
            Assert.IsNotNull(response.Content);
        }
        public void PutComment_ShouldReturnData()
        {
            var testUser = new UserDto()
            {
                Username = "******",
                DisplayName = "VALIDDISPLAYNAME",
                AuthCode = new string('b', 40)
            };

            var post = new PostDto()
            {
                Title = "Test Title",
                Content = "Test post text",
                Tags = new List<string>() { "tag1", "Tag2" }
            };

            var commentDto = new CommentDto() { Text = "Test comment" };


            UserLogedDto userModel = RegisterTestUser(httpServer, testUser);
            var response = httpServer.Post("api/posts?sessionKey=" + userModel.SessionKey, post);
            var contentString = response.Content.ReadAsStringAsync().Result;
            var postDto = JsonConvert.DeserializeObject<PostDto>(contentString);

            var responsePutComment = httpServer.Put(
                "api/posts/" + postDto.Id + "/comment?sessionKey=" + userModel.SessionKey, 
                commentDto);

            Assert.AreEqual(HttpStatusCode.OK, responsePutComment.StatusCode);
            Assert.IsNull(responsePutComment.Content);
        }
        public void PostsByTags_ShouldReturnData()
        {
            var testUser = new UserDto()
            {
                Username = "******",
                DisplayName = "VALIDDISPLAYNAME",
                AuthCode = new string('b', 40)
            };

            var post = new PostDto()
            {
                Title = "Test Title",
                Content = "Test post text",
                Tags = new List<string>() { "tag1", "Tag2" } // This chesk is searching is case insensitive
            };


            UserLogedDto userModel = RegisterTestUser(httpServer, testUser);
            var response = httpServer.Post("api/posts?sessionKey=" + userModel.SessionKey, post);

            var responseByTags = httpServer.Get("api/posts?tags=tag1,tag2&sessionKey=" + userModel.SessionKey);

            // Check is post with tags added to database(in current transaction).
            Assert.AreEqual(HttpStatusCode.Created, response.StatusCode);
            Assert.IsNotNull(response.Content);

            Assert.AreEqual(HttpStatusCode.OK, responseByTags.StatusCode);
            Assert.IsNotNull(responseByTags.Content);
        }