public void PostTitleRemovesBadCharacters() { PostBLL postBLL = new PostBLL(); string inputPostTitle = "And we're live! Kicking off with the gas all the way down!"; string sut = postBLL.UrlTitleWithDashes(inputPostTitle); sut = postBLL.SanitizedUrlTitle(sut); string result = "And-were-live-Kicking-off-with-the-gas-all-the-way-down"; Assert.That(sut, Is.EqualTo(result)); }
public void PostTitleAddedDashes() { PostBLL postBLL = new PostBLL(); string inputPostTitle = "And we're live! Kicking off with the gas all the way down!"; string sut = postBLL.UrlTitleWithDashes(inputPostTitle); string result = "And-we're-live!-Kicking-off-with-the-gas-all-the-way-down!"; Console.WriteLine(sut); Assert.That(sut, Is.EqualTo(result)); }
public ActionResult Edit(EditPostViewModel model, DateTime date, string tags, HttpPostedFileBase file) { //Unnecessary right now. //bool validateTitle = _db.ValidateDuplicateTitle(model.Title); if (ModelState.IsValid) { PostBLL postBLL = new PostBLL(); string photoPath = ImageUtility.UpdatePhoto(file, ImagePath.BlogPostImage); Post post = postBLL.UpdatePost(model.Id, model.Title, model.Body, date, tags, photoPath); return RedirectToAction("Post", new { UrlTitle = post.UrlTitle }); } //Something went wrong model.Date = date; model.File = file; ViewBag.Tags = tags; return View(model); }