public void TestAddArticle() { var article = new Article { Title = "A Test", Body = "1,2,4,343,3,4,drwerdf3,,4234,%^#$%2", Description = "", TagList = new List <string> { "test", "number" }, Author = new User() { UserName = "******" }, Slug = "A Test".GenerateSlug(), CreatedAt = DateTime.Now, UpdatedAt = DateTime.Now }; var result = _service.AddArticle(article); Assert.True(result > 0); }
public ArticlesModule() : base("/articles") { Get("/", args => { var authorName = Request.Query.@author; var tag = Request.Query.@tag; var favorited = Request.Query.@favorited; throw new NotImplementedException(); }); Get("/{slug:string}", args => { throw new NotImplementedException(); }); Get("/feed", args => { throw new NotImplementedException(); }); Post("/", args => { var article = this.Bind <Article>(); _service.AddArticle(article); return("OK"); }); Delete("/{slug:string}", args => { throw new NotImplementedException(); }); Put("/{slug:string}", args => { var article = this.Bind <Article>(); throw new NotImplementedException(); }); Post("/{slug:string}/favorite", args => { throw new NotImplementedException(); }); Delete("/{slug:string}/favorite", args => { throw new NotImplementedException(); }); }