public void GetByTags_WhenNoTagsAreSearched_ShouldReturn400Response()
{
var posts = new List<PostModel>()
{
new PostModel()
{
Title = "post",
Text = "Pesho posted a new post 1!!!"
},
new PostModel()
{
Title = "post new yeah",
Text = "Pesho posted a new post 2!!!",
Tags = new List<string>() { "new" }
},
new PostModel()
{
Title = "post new and oldy",
Text = "Pesho posted a new post 3!!!",
Tags = new List<string>() { "taggy", "old" }
}
};
// Add some tags
foreach (var postModel in posts)
{
this.httpServer.Post("api/posts", postModel, this.sessionKeyHeader);
}
var httpResponse = this.httpServer.Get("api/posts?tags=", this.sessionKeyHeader);
Assert.AreEqual(HttpStatusCode.BadRequest, httpResponse.StatusCode);
}