Esempio n. 1
0
        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));
        }
Esempio n. 2
0
        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));
        }
Esempio n. 3
0
        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);
        }