Beispiel #1
0
 public void BlogEntry_is_Added_to_Blog()
 {
     var blogEntry = new BlogEntry(string.Empty);
     var blog = new Blog();
     blog.Add(blogEntry);
     Assert.AreEqual(1, blog.Entries.Count());
 }
Beispiel #2
0
 public void Add(BlogEntry blogEntry)
 {
     _entries.Add(blogEntry);
 }
Beispiel #3
0
 public ActionResult Edit(BlogEntry blogEntry)
 {
     var entity = currentBlog.Entries.FirstOrDefault(x => x.Title == blogEntry.Title);
     entity.Body = blogEntry.Body;
     return this.RedirectToAction("Detail", new { uniquetitle = entity.Title });
 }
Beispiel #4
0
        public ActionResult Create(BlogEntry blogEntry)
        {
            currentBlog.Add(blogEntry);

            return this.View(blogEntry);
        }
Beispiel #5
0
        public void BlogEntry_Title_Is_Provided_Title_On_Creation()
        {
            var blogEntry = new BlogEntry(string.Empty);

            Assert.AreEqual(string.Empty, blogEntry.Title);
        }
Beispiel #6
0
        public void BlogEntry_TimeStamp_Is_Bigger_Then_Default()
        {
            var blogEntry = new BlogEntry(string.Empty);

            Assert.That(blogEntry.CreatedAt,Is.GreaterThan(default(DateTime)));
        }
Beispiel #7
0
        public void BlogEntry_Body_Is_Empty_On_Creation()
        {
            var blogEntry = new BlogEntry(string.Empty);

            Assert.AreEqual(string.Empty, blogEntry.Body);
        }
Beispiel #8
0
        public void Post_Create_Action_Added_Blog_Entry_To_Blog()
        {
            var homeController = new HomeController();
            var blog = HomeController.currentBlog;

            var model = new BlogEntry(string.Empty);

            Assert.AreEqual(string.Empty, model.Title);

            model.Title = "My Title";
            model.Body = "My Body";

            var result = homeController.Create(model) as ViewResult;

            Assert.That(blog.Entries.Count(), Is.GreaterThan(0));
        }