public void CanAContentBeUpdated() { var maxid = _testRepo.FindAll().Min(m => m.contentid); Content a = new Content() { contentid = maxid, headerimage = "Some image from test _ updated", tabimage = "Some Name from test _ updated", slug = $"new-post-from-test _ updated{maxid}", body = "some awesome tesx _ updated", title = "some title added from test _ updated", authorid = 1, views = 1, stars = (float)4.5, published = true, staged = true, draft = true, created_on = DateTime.Now, published_on = DateTime.Now }; _testRepo.Update(a); var updatedContent = _testRepo.FindByID(maxid); Assert.AreEqual(a.slug, updatedContent.slug); }
public static void ClassStart(TestContext context) { var config = GeneralHelpers.InitConfiguration(); ContentRepo a = new ContentRepo(config); _testRepo = a; var insert_value = a.FindAll().Where(w => w.slug == "new-post-from-test"); if (insert_value.Count() > 0) { var id = insert_value.Where(w => w.slug == "new-post-from-test").First().contentid; a.Remove(id); } Content con = new Content() { contentid = 6, headerimage = "Some image from test _ updated", tabimage = "Some Name from test _ updated", slug = "new-post-from-test _ updated", body = "some awesome tesx _ updated", title = "some title added from test _ updated", authorid = 1, views = 1, stars = (float)4.5, published = true, staged = true, draft = true, created_on = DateTime.Now, published_on = DateTime.Now }; _testRepo.Update(con); }
public void Put(int id, [FromBody] Content data) { ContentRepo.Update(data); _log.LogInformation($"The Content that was updated {JsonConvert.SerializeObject(data)}"); }