Exemplo n.º 1
0
        public void ExpiredBlogsNotIncluded()
        {
            IEnumerable <BlogEntry> blogs = bops.GetUnexpiredPosts();

            foreach (var blog in blogs)
            {
                if (blog.DateExpire != null)
                {
                    Assert.IsTrue(blog.DateExpire > DateTime.Today);
                }
            }
        }
Exemplo n.º 2
0
        //Testing new pagination/routing
        public ActionResult Blog(int?id, int?page)
        {
            var repo = RepositoryFactory.CreateRepository();
            var vm   = new BlogVM();

            vm.BlogEntries = _blops.GetUnexpiredPosts();

            if (id != null)
            {
                vm.BlogEntries = _blops.BlogsByTag(id);
            }
            var pageNumber = page ?? 1;

            // The 2nd param in the next line defines the size of the page
            vm.BlogEntries = vm.BlogEntries.ToPagedList(pageNumber, 5);
            vm.Tags        = repo.GetAllTags();
            return(View(vm));
        }